Commit c2c0af0 1 parent 75a7d0c commit c2c0af0 Copy full SHA for c2c0af0
File tree 9 files changed +406
-233
lines changed
9 files changed +406
-233
lines changed Original file line number Diff line number Diff line change 45
45
"vite" : " ^3.0.0-0 || ^4.0.0-0"
46
46
},
47
47
"dependencies" : {
48
- "@babel/core" : " ^7.21.3" ,
48
+ "@babel/core" : " ^7.22.17" ,
49
+ "@babel/plugin-proposal-decorators" : " ^7.22.15" ,
50
+ "@babel/plugin-syntax-import-attributes" : " ^7.22.5" ,
49
51
"@babel/plugin-syntax-import-meta" : " ^7.10.4" ,
50
- "@babel/plugin-transform-typescript" : " ^7.21.3 " ,
52
+ "@babel/plugin-transform-typescript" : " ^7.22.15 " ,
51
53
"@vue/babel-plugin-jsx" : " ^1.1.1" ,
52
54
"@vue/compiler-dom" : " ^3.2.47" ,
53
55
"esno" : " ^0.16.3" ,
Original file line number Diff line number Diff line change 1
- import path from 'path'
1
+ import path from 'node: path'
2
2
import MagicString from 'magic-string'
3
3
import { parse as vueParse , transform as vueTransform } from '@vue/compiler-dom'
4
4
import { parse as babelParse , traverse as babelTraverse } from '@babel/core'
5
5
import vueJsxPlugin from '@vue/babel-plugin-jsx'
6
6
import typescriptPlugin from '@babel/plugin-transform-typescript'
7
7
import importMeta from '@babel/plugin-syntax-import-meta'
8
- import { parseJSXIdentifier } from '../utils'
8
+ import decoratorsPlugin from '@babel/plugin-proposal-decorators'
9
+ import importAttributesPlugin from '@babel/plugin-syntax-import-attributes'
9
10
import { normalizePath } from 'vite'
10
11
11
12
const EXCLUDE_TAG = [ 'template' , 'script' , 'style' ]
@@ -62,6 +63,14 @@ export async function compileSFCTemplate(
62
63
typescriptPlugin ,
63
64
{ isTSX : true , allowExtensions : true } ,
64
65
] ,
66
+ [
67
+ decoratorsPlugin ,
68
+ { legacy : true } ,
69
+ ] ,
70
+ [
71
+ importAttributesPlugin ,
72
+ { deprecatedAssertSyntax : true } ,
73
+ ] ,
65
74
] ,
66
75
} )
67
76
Original file line number Diff line number Diff line change 8
8
"dependencies" : {
9
9
"@vue/composition-api" : " ^1.7.1" ,
10
10
"vue" : " 2.7.14" ,
11
+ "vue-property-decorator" : " ^9.1.2" ,
11
12
"vue-template-compiler" : " 2.7.14"
12
13
},
13
14
"devDependencies" : {
Original file line number Diff line number Diff line change 1
1
<script lang="ts">
2
2
import Hi from ' ./Hi.vue'
3
3
import Welcome from ' ./Welcome'
4
+ import Count from ' ./Count.vue'
4
5
export default {
5
6
name: ' App' ,
6
7
components: {
7
8
Hi ,
8
9
Welcome ,
10
+ Count ,
9
11
},
10
12
}
11
13
</script >
@@ -15,6 +17,7 @@ export default {
15
17
<div >
16
18
<Hi />
17
19
<Welcome />
20
+ <Count />
18
21
<!-- -->
19
22
<!-- -->
20
23
<!-- -->
Original file line number Diff line number Diff line change
1
+ <script lang="ts">
2
+ import { Component , Prop , Vue } from ' vue-property-decorator'
3
+
4
+ @Component
5
+ export default class MyComponent extends Vue {
6
+ @Prop () readonly message! : string
7
+ @Prop ({ default: 0 }) count! : number
8
+
9
+ increment() {
10
+ this .count ++
11
+ }
12
+ }
13
+ </script >
14
+
15
+ <template >
16
+ <div >
17
+ <p >Message: {{ message }}</p >
18
+ <p >Count: {{ count }}</p >
19
+ <button @click =" increment" >
20
+ Increment
21
+ </button >
22
+ </div >
23
+ </template >
Original file line number Diff line number Diff line change 1
- import { defineComponent } from "@vue/composition-api"
2
-
3
- export default defineComponent ( {
4
- name : "Welcome" ,
5
- setup ( ) {
6
- return ( ) => < p style = "color: #fcb80f;cursor: pointer;" > Welcome to here 🚀 .</ p >
7
- } ,
8
- } )
1
+ // import { defineComponent } from "@vue/composition-api"
2
+
3
+ // export default defineComponent({
4
+ // name: "Welcome",
5
+ // setup() {
6
+ // return () => <p style="color: #fcb80f;cursor: pointer;"> Welcome to here 🚀 .</p>
7
+ // },
8
+ // })
9
+
10
+ import Vue from 'vue'
11
+ import { Component } from 'vue-property-decorator'
12
+
13
+ @Component
14
+ export default class Welcome extends Vue {
15
+ private count = 0
16
+
17
+ private get message ( ) : string {
18
+ return `Count: ${ this . count } `
19
+ }
20
+
21
+ private increment ( ) : void {
22
+ this . count ++
23
+ }
24
+
25
+ render ( ) {
26
+ return (
27
+ < div >
28
+ < h1 > { this . message } </ h1 >
29
+ < button onClick = { this . increment } > Increment</ button >
30
+ </ div >
31
+ )
32
+ }
33
+ }
Original file line number Diff line number Diff line change 6
6
"strict" : true ,
7
7
"module" : "ESNext" ,
8
8
"moduleResolution" : "Node" ,
9
- "jsx" : "preserve"
9
+ "jsx" : "preserve" ,
10
+ "experimentalDecorators" : true
10
11
} ,
11
- "include" : [ "src" ] ,
12
- }
12
+ "include" : [ "src" ]
13
+ }
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ export default defineConfig({
14
14
vue : 2 ,
15
15
toggleButtonVisibility : 'always' ,
16
16
enabled : true ,
17
+ disableInspectorOnEditorOpen : true ,
17
18
} ) ,
18
19
] ,
19
20
} )
You can’t perform that action at this time.
0 commit comments