File tree Expand file tree Collapse file tree 9 files changed +406
-233
lines changed Expand file tree Collapse file tree 9 files changed +406
-233
lines changed Original file line number Diff line number Diff line change 4545 "vite" : " ^3.0.0-0 || ^4.0.0-0"
4646 },
4747 "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" ,
4951 "@babel/plugin-syntax-import-meta" : " ^7.10.4" ,
50- "@babel/plugin-transform-typescript" : " ^7.21.3 " ,
52+ "@babel/plugin-transform-typescript" : " ^7.22.15 " ,
5153 "@vue/babel-plugin-jsx" : " ^1.1.1" ,
5254 "@vue/compiler-dom" : " ^3.2.47" ,
5355 "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'
22import MagicString from 'magic-string'
33import { parse as vueParse , transform as vueTransform } from '@vue/compiler-dom'
44import { parse as babelParse , traverse as babelTraverse } from '@babel/core'
55import vueJsxPlugin from '@vue/babel-plugin-jsx'
66import typescriptPlugin from '@babel/plugin-transform-typescript'
77import 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'
910import { normalizePath } from 'vite'
1011
1112const EXCLUDE_TAG = [ 'template' , 'script' , 'style' ]
@@ -62,6 +63,14 @@ export async function compileSFCTemplate(
6263 typescriptPlugin ,
6364 { isTSX : true , allowExtensions : true } ,
6465 ] ,
66+ [
67+ decoratorsPlugin ,
68+ { legacy : true } ,
69+ ] ,
70+ [
71+ importAttributesPlugin ,
72+ { deprecatedAssertSyntax : true } ,
73+ ] ,
6574 ] ,
6675 } )
6776
Original file line number Diff line number Diff line change 88 "dependencies" : {
99 "@vue/composition-api" : " ^1.7.1" ,
1010 "vue" : " 2.7.14" ,
11+ "vue-property-decorator" : " ^9.1.2" ,
1112 "vue-template-compiler" : " 2.7.14"
1213 },
1314 "devDependencies" : {
Original file line number Diff line number Diff line change 11<script lang="ts">
22import Hi from ' ./Hi.vue'
33import Welcome from ' ./Welcome'
4+ import Count from ' ./Count.vue'
45export default {
56 name: ' App' ,
67 components: {
78 Hi ,
89 Welcome ,
10+ Count ,
911 },
1012}
1113 </script >
@@ -15,6 +17,7 @@ export default {
1517 <div >
1618 <Hi />
1719 <Welcome />
20+ <Count />
1821 <!-- -->
1922 <!-- -->
2023 <!-- -->
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 66 "strict" : true ,
77 "module" : " ESNext" ,
88 "moduleResolution" : " Node" ,
9- "jsx" : " preserve"
9+ "jsx" : " preserve" ,
10+ "experimentalDecorators" : true
1011 },
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({
1414 vue : 2 ,
1515 toggleButtonVisibility : 'always' ,
1616 enabled : true ,
17+ disableInspectorOnEditorOpen : true ,
1718 } ) ,
1819 ] ,
1920} )
You can’t perform that action at this time.
0 commit comments