-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(experimental): support ref transform for sfc normal
<script>
- Loading branch information
Showing
8 changed files
with
226 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 0 additions & 43 deletions
43
packages/compiler-sfc/__tests__/__snapshots__/compileScriptRefSugar.spec.ts.snap
This file was deleted.
Oops, something went wrong.
80 changes: 80 additions & 0 deletions
80
packages/compiler-sfc/__tests__/__snapshots__/compileScriptRefTransform.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`sfc ref transform $ unwrapping 1`] = ` | ||
"import { ref, shallowRef } from 'vue' | ||
export default { | ||
setup(__props, { expose }) { | ||
expose() | ||
let foo = (ref()) | ||
let a = (ref(1)) | ||
let b = (shallowRef({ | ||
count: 0 | ||
})) | ||
let c = () => {} | ||
let d | ||
return { foo, a, b, c, d, ref, shallowRef } | ||
} | ||
}" | ||
`; | ||
|
||
exports[`sfc ref transform $ref & $shallowRef declarations 1`] = ` | ||
"import { ref as _ref, shallowRef as _shallowRef } from 'vue' | ||
export default { | ||
setup(__props, { expose }) { | ||
expose() | ||
let foo = _ref() | ||
let a = _ref(1) | ||
let b = _shallowRef({ | ||
count: 0 | ||
}) | ||
let c = () => {} | ||
let d | ||
return { foo, a, b, c, d } | ||
} | ||
}" | ||
`; | ||
|
||
exports[`sfc ref transform usage in normal <script> 1`] = ` | ||
"import { ref as _ref } from 'vue' | ||
export default { | ||
setup() { | ||
let count = _ref(0) | ||
const inc = () => count.value++ | ||
return ({ count }) | ||
} | ||
} | ||
" | ||
`; | ||
exports[`sfc ref transform usage with normal <script> + <script setup> 1`] = ` | ||
"import { ref as _ref } from 'vue' | ||
let a = _ref(0) | ||
let c = _ref(0) | ||
export default { | ||
setup(__props, { expose }) { | ||
expose() | ||
let b = _ref(0) | ||
let c = 0 | ||
function change() { | ||
a.value++ | ||
b.value++ | ||
c++ | ||
} | ||
return { a, c, b, change } | ||
} | ||
}" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.