fix(compiler-sfc): should not rewrite scope variable (#3449)

fix #3445
This commit is contained in:
edison
2021-03-26 04:16:48 +08:00
committed by GitHub
parent ca6aa01181
commit bbc5fe6a97
3 changed files with 90 additions and 10 deletions

View File

@@ -626,6 +626,35 @@ return { }
}"
`;
exports[`SFC compile <script setup> ref: syntax sugar should not rewrite scope variable 1`] = `
"import { ref as _ref } from 'vue'
export default {
expose: [],
setup(__props) {
const a = _ref(1)
const b = _ref(1)
const d = _ref(1)
const e = 1
function test() {
const a = 2
console.log(a)
console.log(b.value)
let c = { c: 3 }
console.log(c)
let $d
console.log($d)
console.log(d.value)
console.log(e)
}
return { a, b, d, e, test }
}
}"
`;
exports[`SFC compile <script setup> ref: syntax sugar using ref binding in property shorthand 1`] = `
"import { ref as _ref } from 'vue'