fix(compiler-sfc): handle empty strings during template usage analysis of setup bindings (#4608)

fix #4599
This commit is contained in:
Thorsten Lünborg
2021-09-16 19:47:11 +02:00
committed by GitHub
parent fcd5422b4a
commit bdb1a7958b
3 changed files with 32 additions and 1 deletions

View File

@@ -342,6 +342,21 @@ defineExpose({ foo: 123 })
assertCode(content)
})
// https://github.com/vuejs/vue-next/issues/4599
test('attribute expressions', () => {
const { content } = compile(`
<script setup lang="ts">
import { bar, baz } from './x'
const cond = true
</script>
<template>
<div :class="[cond ? '' : bar(), 'default']" :style="baz"></div>
</template>
`)
expect(content).toMatch(`return { cond, bar, baz }`)
assertCode(content)
})
test('vue interpolations', () => {
const { content } = compile(`
<script setup lang="ts">