mirror of
https://github.com/vuejs/vue.git
synced 2024-11-21 20:28:54 +00:00
parent
24fcf69624
commit
83d95351a9
@ -1818,6 +1818,8 @@ function resolveTemplateUsageCheckString(sfc: SFCDescriptor, isTS: boolean) {
|
|||||||
if (value) {
|
if (value) {
|
||||||
code += `,${processExp(value, isTS, baseName)}`
|
code += `,${processExp(value, isTS, baseName)}`
|
||||||
}
|
}
|
||||||
|
} else if (name === 'ref') {
|
||||||
|
code += `,${value}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -364,6 +364,20 @@ return { vMyDir }
|
|||||||
})"
|
})"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`SFC compile <script setup> > dev mode import usage check > imported ref as template ref 1`] = `
|
||||||
|
"import { defineComponent as _defineComponent } from 'vue'
|
||||||
|
import { aref } from './x'
|
||||||
|
|
||||||
|
export default /*#__PURE__*/_defineComponent({
|
||||||
|
setup(__props) {
|
||||||
|
|
||||||
|
|
||||||
|
return { aref }
|
||||||
|
}
|
||||||
|
|
||||||
|
})"
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`SFC compile <script setup> > dev mode import usage check > js template string interpolations 1`] = `
|
exports[`SFC compile <script setup> > dev mode import usage check > js template string interpolations 1`] = `
|
||||||
"import { defineComponent as _defineComponent } from 'vue'
|
"import { defineComponent as _defineComponent } from 'vue'
|
||||||
import { VAR, VAR2, VAR3 } from './x'
|
import { VAR, VAR2, VAR3 } from './x'
|
||||||
|
@ -398,6 +398,19 @@ defineExpose({ foo: 123 })
|
|||||||
assertCode(content)
|
assertCode(content)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('imported ref as template ref', () => {
|
||||||
|
const { content } = compile(`
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { aref } from './x'
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<div ref="aref"></div>
|
||||||
|
</template>
|
||||||
|
`)
|
||||||
|
expect(content).toMatch(`return { aref }`)
|
||||||
|
assertCode(content)
|
||||||
|
})
|
||||||
|
|
||||||
test('vue interpolations', () => {
|
test('vue interpolations', () => {
|
||||||
const { content } = compile(`
|
const { content } = compile(`
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
Loading…
Reference in New Issue
Block a user