File tree Expand file tree Collapse file tree 4 files changed +38
-7
lines changed
demo-app/imports/ui/components Expand file tree Collapse file tree 4 files changed +38
-7
lines changed Original file line number Diff line number Diff line change 1
1
<script >
2
- import Hello from ' ./Hello.vue'
3
-
4
- console .log (Hello)
2
+ import Counter from ' ./Counter.vue'
3
+ import ScriptSetup from ' ./ScriptSetup.vue'
5
4
6
5
export default {
7
6
components: {
8
- Hello,
7
+ Counter,
8
+ ScriptSetup,
9
9
},
10
10
}
11
11
</script >
12
12
13
13
<template >
14
- <Hello />
14
+ <Counter />
15
+ <ScriptSetup />
15
16
</template >
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export default {
7
7
8
8
function increment () {
9
9
counter .value ++
10
+ console .log (' incremented!' )
10
11
}
11
12
12
13
return {
@@ -20,11 +21,12 @@ export default {
20
21
<template >
21
22
<button @click =" increment()" >Click Me</button >
22
23
<p >You've pressed the button {{counter}} times.</p >
24
+ <button @click =" meow.waf()" >Throw template error</button >
23
25
</template >
24
26
25
27
<style scoped>
26
28
button {
27
- background : green ;
29
+ background : rgb ( 28 , 124 , 76 ) ;
28
30
color : white ;
29
31
border : none ;
30
32
border-radius : 6px ;
Original file line number Diff line number Diff line change
1
+ <script setup>
2
+ import { ref } from ' vue'
3
+
4
+ const counter = ref (0 )
5
+
6
+ function increment () {
7
+ counter .value ++
8
+ console .log (' incremented!' )
9
+ }
10
+ </script >
11
+
12
+ <template >
13
+ <button @click =" increment()" >Click Me</button >
14
+ <p >You've pressed the button {{counter}} times.</p >
15
+ </template >
16
+
17
+ <style scoped>
18
+ button {
19
+ background : #224e64 ;
20
+ color : white ;
21
+ border : none ;
22
+ border-radius : 6px ;
23
+ padding : 8px 12px ;
24
+ cursor : pointer ;
25
+ }
26
+ </style >
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ export class VueCompiler extends MultiFileCachingCompiler {
42
42
const hasScoped = descriptor . styles . some ( ( s ) => s . scoped )
43
43
const scopeId = hash ( inputFile . getPathInPackage ( ) )
44
44
45
- if ( descriptor . script ) {
45
+ if ( descriptor . script || descriptor . scriptSetup ) {
46
46
const scriptResult = compileScript ( descriptor , {
47
47
id : scopeId ,
48
48
isProd,
@@ -65,6 +65,8 @@ export class VueCompiler extends MultiFileCachingCompiler {
65
65
} )
66
66
if ( ! compileResult . source ) {
67
67
compileResult . source = 'const __script__ = {};'
68
+ } else {
69
+ compileResult . source += '\n'
68
70
}
69
71
const lines = compileResult . source . split ( '\n' ) . length
70
72
compileResult . source += templateResult . code
You can’t perform that action at this time.
0 commit comments