create-quasar 1.0.28 → 1.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/app/quasar-v2/js-vite/i18n/src/boot/i18n.js +1 -0
- package/templates/app/quasar-v2/js-webpack/i18n/src/boot/i18n.js +1 -0
- package/templates/app/quasar-v2/ts-vite/BASE/_package.json +1 -1
- package/templates/app/quasar-v2/ts-vite/BASE/src/App.vue +6 -4
- package/templates/app/quasar-v2/ts-vite/BASE/src/components/EssentialLink.vue +16 -4
- package/templates/app/quasar-v2/ts-vite/BASE/src/components/ExampleComponent.vue +27 -4
- package/templates/app/quasar-v2/ts-vite/BASE/src/layouts/MainLayout.vue +58 -4
- package/templates/app/quasar-v2/ts-vite/BASE/src/pages/ErrorNotFound.vue +7 -4
- package/templates/app/quasar-v2/ts-vite/BASE/src/pages/IndexPage.vue +34 -4
- package/templates/app/quasar-v2/ts-vite/i18n/src/boot/i18n.ts +20 -1
- package/templates/app/quasar-v2/ts-vite/index.js +1 -0
- package/templates/app/quasar-v2/ts-vite/pinia/src/stores/index.ts +12 -0
- package/templates/app/quasar-v2/ts-vite/vuex/src/store/index.ts +8 -0
- package/templates/app/quasar-v2/ts-webpack/BASE/_package.json +1 -1
- package/templates/app/quasar-v2/ts-webpack/BASE/src/App.vue +7 -4
- package/templates/app/quasar-v2/ts-webpack/BASE/src/components/EssentialLink.vue +16 -4
- package/templates/app/quasar-v2/ts-webpack/BASE/src/components/ExampleComponent.vue +27 -4
- package/templates/app/quasar-v2/ts-webpack/BASE/src/layouts/MainLayout.vue +58 -4
- package/templates/app/quasar-v2/ts-webpack/BASE/src/pages/ErrorNotFound.vue +7 -4
- package/templates/app/quasar-v2/ts-webpack/BASE/src/pages/IndexPage.vue +34 -4
- package/templates/app/quasar-v2/ts-webpack/i18n/src/boot/i18n.ts +21 -2
- package/templates/app/quasar-v2/ts-webpack/index.js +1 -0
- package/templates/app/quasar-v2/ts-webpack/pinia/src/stores/index.ts +12 -0
- package/templates/app/quasar-v2/ts-webpack/vuex/src/store/index.ts +8 -0
- package/utils/index.js +2 -2
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
<% if (typescriptConfig === 'class') { %>"vue-class-component": "^8.0.0-rc.1",<% } %>
|
|
16
16
|
<% if (preset.axios) { %>"axios": "^0.21.1",<% } %>
|
|
17
|
-
<% if (preset.i18n) { %>"vue-i18n": "^9.
|
|
17
|
+
<% if (preset.i18n) { %>"vue-i18n": "^9.2.2",<% } %>
|
|
18
18
|
<% if (preset.pinia) { %>"pinia": "^2.0.11",<% } %>
|
|
19
19
|
<% if (preset.vuex) { %>"vuex": "^4.0.1",<% } %>
|
|
20
20
|
"@quasar/extras": "^1.0.0",
|
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
<router-view />
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
<% if (typescriptConfig === 'composition') {
|
|
5
|
+
<% if (typescriptConfig === 'composition-setup') { %><script setup lang="ts">
|
|
6
|
+
<% } else if (typescriptConfig === 'composition') { %><script lang="ts">
|
|
7
|
+
import { defineComponent } from 'vue';
|
|
7
8
|
|
|
8
9
|
export default defineComponent({
|
|
9
10
|
name: 'App'
|
|
10
|
-
});<% } else if (typescriptConfig === 'options') {
|
|
11
|
+
});<% } else if (typescriptConfig === 'options') { %><script lang="ts">
|
|
12
|
+
import { defineComponent } from 'vue';
|
|
11
13
|
|
|
12
14
|
export default defineComponent({
|
|
13
15
|
name: 'App'
|
|
14
|
-
});<% } else if (typescriptConfig === 'class') {
|
|
16
|
+
});<% } else if (typescriptConfig === 'class') { %><script lang="ts">
|
|
15
17
|
import { Vue } from 'vue-class-component'
|
|
16
18
|
|
|
17
19
|
export default class App extends Vue {}<% } %>
|
|
@@ -19,8 +19,19 @@
|
|
|
19
19
|
</q-item>
|
|
20
20
|
</template>
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
<% if (typescriptConfig === 'composition-setup') { %><script setup lang="ts">
|
|
23
|
+
export interface EssentialLinkProps {
|
|
24
|
+
title: string;
|
|
25
|
+
caption?: string;
|
|
26
|
+
link?: string;
|
|
27
|
+
icon?: string;
|
|
28
|
+
}
|
|
29
|
+
withDefaults(defineProps<EssentialLinkProps>(), {
|
|
30
|
+
caption: '',
|
|
31
|
+
link: '#',
|
|
32
|
+
icon: '',
|
|
33
|
+
});<% } else if (typescriptConfig === 'composition') { %><script lang="ts">
|
|
34
|
+
import { defineComponent } from 'vue';
|
|
24
35
|
|
|
25
36
|
export default defineComponent({
|
|
26
37
|
name: 'EssentialLink',
|
|
@@ -45,7 +56,8 @@ export default defineComponent({
|
|
|
45
56
|
default: ''
|
|
46
57
|
}
|
|
47
58
|
}
|
|
48
|
-
});<% } else if (typescriptConfig === 'options') {
|
|
59
|
+
});<% } else if (typescriptConfig === 'options') { %><script lang="ts">
|
|
60
|
+
import { defineComponent } from 'vue';
|
|
49
61
|
|
|
50
62
|
export default defineComponent({
|
|
51
63
|
name: 'EssentialLink',
|
|
@@ -70,7 +82,7 @@ export default defineComponent({
|
|
|
70
82
|
default: ''
|
|
71
83
|
}
|
|
72
84
|
}
|
|
73
|
-
});<% } else if (typescriptConfig === 'class') {
|
|
85
|
+
});<% } else if (typescriptConfig === 'class') { %><script lang="ts">
|
|
74
86
|
import { Vue, prop, Options } from 'vue-class-component';
|
|
75
87
|
|
|
76
88
|
class Props {
|
|
@@ -12,8 +12,29 @@
|
|
|
12
12
|
</div>
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
<% if (typescriptConfig === 'composition-setup') { %><script setup lang="ts">
|
|
16
|
+
import { computed, ref } from 'vue';
|
|
17
|
+
import { Todo, Meta } from './models';
|
|
18
|
+
|
|
19
|
+
interface Props {
|
|
20
|
+
title: string;
|
|
21
|
+
todos?: Todo[];
|
|
22
|
+
meta: Meta;
|
|
23
|
+
active: boolean;
|
|
24
|
+
}
|
|
25
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
26
|
+
todos: () => [],
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const clickCount = ref(0);
|
|
30
|
+
function increment() {
|
|
31
|
+
clickCount.value += 1;
|
|
32
|
+
return clickCount.value;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const todoCount = computed(() => props.todos.length);
|
|
36
|
+
<% } else if (typescriptConfig === 'composition') { %><script lang="ts">
|
|
37
|
+
import {
|
|
17
38
|
defineComponent,
|
|
18
39
|
PropType,
|
|
19
40
|
computed,
|
|
@@ -60,7 +81,8 @@ export default defineComponent({
|
|
|
60
81
|
setup (props) {
|
|
61
82
|
return { ...useClickCount(), ...useDisplayTodo(toRef(props, 'todos')) };
|
|
62
83
|
},
|
|
63
|
-
});<% } else if (typescriptConfig === 'options') {
|
|
84
|
+
});<% } else if (typescriptConfig === 'options') { %><script lang="ts">
|
|
85
|
+
import { defineComponent, PropType } from 'vue';
|
|
64
86
|
import { Todo, Meta } from './models';
|
|
65
87
|
|
|
66
88
|
export default defineComponent({
|
|
@@ -97,7 +119,8 @@ export default defineComponent({
|
|
|
97
119
|
return this.todos.length;
|
|
98
120
|
}
|
|
99
121
|
}
|
|
100
|
-
});<% } else if (typescriptConfig === 'class') {
|
|
122
|
+
});<% } else if (typescriptConfig === 'class') { %><script lang="ts">
|
|
123
|
+
import { Vue, prop } from 'vue-class-component';
|
|
101
124
|
import { Todo, Meta } from './models';
|
|
102
125
|
|
|
103
126
|
class Props {
|
|
@@ -45,8 +45,61 @@
|
|
|
45
45
|
</q-layout>
|
|
46
46
|
</template>
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
<% if (typescriptConfig === 'composition-setup') { %><script setup lang="ts">
|
|
49
|
+
import { ref } from 'vue';
|
|
50
|
+
import EssentialLink, { EssentialLinkProps } from 'components/EssentialLink.vue';
|
|
51
|
+
|
|
52
|
+
const essentialLinks: EssentialLinkProps[] = [
|
|
53
|
+
{
|
|
54
|
+
title: 'Docs',
|
|
55
|
+
caption: 'quasar.dev',
|
|
56
|
+
icon: 'school',
|
|
57
|
+
link: 'https://quasar.dev'
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
title: 'Github',
|
|
61
|
+
caption: 'github.com/quasarframework',
|
|
62
|
+
icon: 'code',
|
|
63
|
+
link: 'https://github.com/quasarframework'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
title: 'Discord Chat Channel',
|
|
67
|
+
caption: 'chat.quasar.dev',
|
|
68
|
+
icon: 'chat',
|
|
69
|
+
link: 'https://chat.quasar.dev'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
title: 'Forum',
|
|
73
|
+
caption: 'forum.quasar.dev',
|
|
74
|
+
icon: 'record_voice_over',
|
|
75
|
+
link: 'https://forum.quasar.dev'
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
title: 'Twitter',
|
|
79
|
+
caption: '@quasarframework',
|
|
80
|
+
icon: 'rss_feed',
|
|
81
|
+
link: 'https://twitter.quasar.dev'
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
title: 'Facebook',
|
|
85
|
+
caption: '@QuasarFramework',
|
|
86
|
+
icon: 'public',
|
|
87
|
+
link: 'https://facebook.quasar.dev'
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
title: 'Quasar Awesome',
|
|
91
|
+
caption: 'Community Quasar projects',
|
|
92
|
+
icon: 'favorite',
|
|
93
|
+
link: 'https://awesome.quasar.dev'
|
|
94
|
+
}
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
const leftDrawerOpen = ref(false)
|
|
98
|
+
|
|
99
|
+
function toggleLeftDrawer() {
|
|
100
|
+
leftDrawerOpen.value = !leftDrawerOpen.value
|
|
101
|
+
}<% } else if (typescriptConfig === 'composition') { %><script lang="ts">
|
|
102
|
+
import { defineComponent, ref } from 'vue';
|
|
50
103
|
import EssentialLink from 'components/EssentialLink.vue';
|
|
51
104
|
|
|
52
105
|
const linksList = [
|
|
@@ -112,7 +165,8 @@ export default defineComponent({
|
|
|
112
165
|
}
|
|
113
166
|
}
|
|
114
167
|
}
|
|
115
|
-
});<% } else if (typescriptConfig === 'options') {
|
|
168
|
+
});<% } else if (typescriptConfig === 'options') { %><script lang="ts">
|
|
169
|
+
import { defineComponent } from 'vue';
|
|
116
170
|
import EssentialLink from 'components/EssentialLink.vue';
|
|
117
171
|
|
|
118
172
|
const linksList = [
|
|
@@ -179,7 +233,7 @@ export default defineComponent({
|
|
|
179
233
|
this.leftDrawerOpen = !this.leftDrawerOpen
|
|
180
234
|
}
|
|
181
235
|
}
|
|
182
|
-
});<% } else if (typescriptConfig === 'class') {
|
|
236
|
+
});<% } else if (typescriptConfig === 'class') { %><script lang="ts">
|
|
183
237
|
import { Vue, Options } from 'vue-class-component';
|
|
184
238
|
import EssentialLink from 'components/EssentialLink.vue';
|
|
185
239
|
|
|
@@ -22,16 +22,19 @@
|
|
|
22
22
|
</div>
|
|
23
23
|
</template>
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
<% if (typescriptConfig === 'composition') {
|
|
25
|
+
<% if (typescriptConfig === 'composition-setup') { %><script setup lang="ts">
|
|
26
|
+
<% } else if (typescriptConfig === 'composition') { %><script lang="ts">
|
|
27
|
+
import { defineComponent } from 'vue';
|
|
27
28
|
|
|
28
29
|
export default defineComponent({
|
|
29
30
|
name: 'ErrorNotFound'
|
|
30
|
-
});<% } else if (typescriptConfig === 'options') {
|
|
31
|
+
});<% } else if (typescriptConfig === 'options') { %><script lang="ts">
|
|
32
|
+
import { defineComponent } from 'vue';
|
|
31
33
|
|
|
32
34
|
export default defineComponent({
|
|
33
35
|
name: 'ErrorNotFound'
|
|
34
|
-
});<% } else if (typescriptConfig === 'class') {
|
|
36
|
+
});<% } else if (typescriptConfig === 'class') { %><script lang="ts">
|
|
37
|
+
import { Vue } from 'vue-class-component';
|
|
35
38
|
|
|
36
39
|
export default class ErrorNotFound extends Vue {}<% } %>
|
|
37
40
|
</script>
|
|
@@ -9,8 +9,37 @@
|
|
|
9
9
|
</q-page>
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
<% if (typescriptConfig === 'composition-setup') { %><script setup lang="ts">
|
|
13
|
+
import { Todo, Meta } from 'components/models';
|
|
14
|
+
import ExampleComponent from 'components/ExampleComponent.vue';
|
|
15
|
+
import { ref } from 'vue';
|
|
16
|
+
|
|
17
|
+
const todos = ref<Todo[]>([
|
|
18
|
+
{
|
|
19
|
+
id: 1,
|
|
20
|
+
content: 'ct1'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 2,
|
|
24
|
+
content: 'ct2'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 3,
|
|
28
|
+
content: 'ct3'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 4,
|
|
32
|
+
content: 'ct4'
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 5,
|
|
36
|
+
content: 'ct5'
|
|
37
|
+
}
|
|
38
|
+
]);
|
|
39
|
+
const meta = ref<Meta>({
|
|
40
|
+
totalCount: 1200
|
|
41
|
+
});<% } else if (typescriptConfig === 'composition') { %><script lang="ts">
|
|
42
|
+
import { Todo, Meta } from 'components/models';
|
|
14
43
|
import ExampleComponent from 'components/ExampleComponent.vue';
|
|
15
44
|
import { defineComponent, ref } from 'vue';
|
|
16
45
|
|
|
@@ -45,7 +74,8 @@ export default defineComponent({
|
|
|
45
74
|
});
|
|
46
75
|
return { todos, meta };
|
|
47
76
|
}
|
|
48
|
-
});<% } else if (typescriptConfig === 'options') {
|
|
77
|
+
});<% } else if (typescriptConfig === 'options') { %><script lang="ts">
|
|
78
|
+
import { Todo, Meta } from 'components/models';
|
|
49
79
|
import ExampleComponent from 'components/ExampleComponent.vue';
|
|
50
80
|
import { defineComponent } from 'vue';
|
|
51
81
|
|
|
@@ -80,7 +110,7 @@ export default defineComponent({
|
|
|
80
110
|
};
|
|
81
111
|
return { todos, meta };
|
|
82
112
|
}
|
|
83
|
-
});<% } else if (typescriptConfig === 'class') {
|
|
113
|
+
});<% } else if (typescriptConfig === 'class') { %><script lang="ts">
|
|
84
114
|
import { Vue, Options } from 'vue-class-component'
|
|
85
115
|
import { Todo, Meta } from 'components/models';
|
|
86
116
|
import ExampleComponent from 'components/ExampleComponent.vue';
|
|
@@ -3,9 +3,28 @@ import { createI18n } from 'vue-i18n';
|
|
|
3
3
|
|
|
4
4
|
import messages from 'src/i18n';
|
|
5
5
|
|
|
6
|
+
export type MessageLanguages = keyof typeof messages;
|
|
7
|
+
// Type-define 'en-US' as the master schema for the resource
|
|
8
|
+
export type MessageSchema = typeof messages["en-US"];
|
|
9
|
+
|
|
10
|
+
// See https://vue-i18n.intlify.dev/guide/advanced/typescript.html#global-resource-schema-type-definition
|
|
11
|
+
/* eslint-disable @typescript-eslint/no-empty-interface */
|
|
12
|
+
declare module "vue-i18n" {
|
|
13
|
+
// define the locale messages schema
|
|
14
|
+
export interface DefineLocaleMessage extends MessageSchema {}
|
|
15
|
+
|
|
16
|
+
// define the datetime format schema
|
|
17
|
+
export interface DefineDateTimeFormat {}
|
|
18
|
+
|
|
19
|
+
// define the number format schema
|
|
20
|
+
export interface DefineNumberFormat {}
|
|
21
|
+
}
|
|
22
|
+
/* eslint-enable @typescript-eslint/no-empty-interface */
|
|
23
|
+
|
|
6
24
|
export default boot(({ app }) => {
|
|
7
25
|
const i18n = createI18n({
|
|
8
|
-
locale: 'en-US'
|
|
26
|
+
locale: 'en-US',<% if (typescriptConfig === 'composition' || typescriptConfig === 'composition-setup') { %>
|
|
27
|
+
legacy: false,<% } %>
|
|
9
28
|
messages,
|
|
10
29
|
});
|
|
11
30
|
|
|
@@ -8,6 +8,7 @@ module.exports = async function ({ scope, utils }) {
|
|
|
8
8
|
initial: 0,
|
|
9
9
|
choices: [
|
|
10
10
|
{ title: 'Composition API', value: 'composition', description: 'recommended' },
|
|
11
|
+
{ title: 'Composition API with <script setup>', value: 'composition-setup', description: 'recommended' },
|
|
11
12
|
{ title: 'Options API', value: 'options' },
|
|
12
13
|
{ title: 'Class-based', value: 'class', description: 'DEPRECATED; see https://github.com/quasarframework/quasar/discussions/11204', disabled: true }
|
|
13
14
|
]
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { store } from 'quasar/wrappers'
|
|
2
2
|
import { createPinia } from 'pinia'
|
|
3
|
+
import { Router } from 'vue-router';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* When adding new properties to stores, you should also
|
|
7
|
+
* extend the `PiniaCustomProperties` interface.
|
|
8
|
+
* @see https://pinia.vuejs.org/core-concepts/plugins.html#typing-new-store-properties
|
|
9
|
+
*/
|
|
10
|
+
declare module 'pinia' {
|
|
11
|
+
export interface PiniaCustomProperties {
|
|
12
|
+
readonly router: Router;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
3
15
|
|
|
4
16
|
/*
|
|
5
17
|
* If not building with SSR mode, you can
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { store } from 'quasar/wrappers'
|
|
2
2
|
import { InjectionKey } from 'vue'
|
|
3
|
+
import { Router } from 'vue-router'
|
|
3
4
|
import {
|
|
4
5
|
createStore,
|
|
5
6
|
Store as VuexStore,
|
|
@@ -35,6 +36,13 @@ declare module '@vue/runtime-core' {
|
|
|
35
36
|
// provide typings for `useStore` helper
|
|
36
37
|
export const storeKey: InjectionKey<VuexStore<StateInterface>> = Symbol('vuex-key')
|
|
37
38
|
|
|
39
|
+
// Provide typings for `this.$router` inside Vuex stores
|
|
40
|
+
declare module "vuex" {
|
|
41
|
+
export interface Store<S> {
|
|
42
|
+
readonly $router: Router;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
38
46
|
export default store(function (/* { ssrContext } */) {
|
|
39
47
|
const Store = createStore<StateInterface>({
|
|
40
48
|
modules: {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
<% if (typescriptConfig === 'class') { %>"vue-class-component": "^8.0.0-rc.1",<% } %>
|
|
16
16
|
<% if (preset.axios) { %>"axios": "^0.21.1",<% } %>
|
|
17
|
-
<% if (preset.i18n) { %>"vue-i18n": "^9.
|
|
17
|
+
<% if (preset.i18n) { %>"vue-i18n": "^9.2.2",<% } %>
|
|
18
18
|
<% if (preset.pinia) { %>"pinia": "^2.0.11",<% } %>
|
|
19
19
|
<% if (preset.vuex) { %>"vuex": "^4.0.1",<% } %>
|
|
20
20
|
"@quasar/extras": "^1.0.0",
|
|
@@ -2,16 +2,19 @@
|
|
|
2
2
|
<router-view />
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
<% if (typescriptConfig === 'composition') {
|
|
5
|
+
<% if (typescriptConfig === 'composition-setup') { %><script setup lang="ts">
|
|
6
|
+
<% } else if (typescriptConfig === 'composition') { %><script lang="ts">
|
|
7
|
+
import { defineComponent } from 'vue';
|
|
7
8
|
|
|
8
9
|
export default defineComponent({
|
|
9
10
|
name: 'App'
|
|
10
|
-
})<% } else if (typescriptConfig === 'options') {
|
|
11
|
+
})<% } else if (typescriptConfig === 'options') { %><script lang="ts">
|
|
12
|
+
import { defineComponent } from 'vue';
|
|
11
13
|
|
|
12
14
|
export default defineComponent({
|
|
13
15
|
name: 'App'
|
|
14
|
-
})<% } else if (typescriptConfig === 'class') {
|
|
16
|
+
})<% } else if (typescriptConfig === 'class') { %><script lang="ts">
|
|
17
|
+
import { Vue } from 'vue-class-component';
|
|
15
18
|
|
|
16
19
|
export default class App extends Vue {}<% } %>
|
|
17
20
|
</script>
|
|
@@ -19,8 +19,19 @@
|
|
|
19
19
|
</q-item>
|
|
20
20
|
</template>
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
<% if (typescriptConfig === 'composition-setup') { %><script setup lang="ts">
|
|
23
|
+
export interface EssentialLinkProps {
|
|
24
|
+
title: string;
|
|
25
|
+
caption?: string;
|
|
26
|
+
link?: string;
|
|
27
|
+
icon?: string;
|
|
28
|
+
}
|
|
29
|
+
withDefaults(defineProps<EssentialLinkProps>(), {
|
|
30
|
+
caption: '',
|
|
31
|
+
link: '#',
|
|
32
|
+
icon: '',
|
|
33
|
+
});<% } else if (typescriptConfig === 'composition') { %><script lang="ts">
|
|
34
|
+
import { defineComponent } from 'vue';
|
|
24
35
|
|
|
25
36
|
export default defineComponent({
|
|
26
37
|
name: 'EssentialLink',
|
|
@@ -45,7 +56,8 @@ export default defineComponent({
|
|
|
45
56
|
default: ''
|
|
46
57
|
}
|
|
47
58
|
}
|
|
48
|
-
});<% } else if (typescriptConfig === 'options') {
|
|
59
|
+
});<% } else if (typescriptConfig === 'options') { %><script lang="ts">
|
|
60
|
+
import { defineComponent } from 'vue';
|
|
49
61
|
|
|
50
62
|
export default defineComponent({
|
|
51
63
|
name: 'EssentialLink',
|
|
@@ -70,7 +82,7 @@ export default defineComponent({
|
|
|
70
82
|
default: ''
|
|
71
83
|
}
|
|
72
84
|
}
|
|
73
|
-
});<% } else if (typescriptConfig === 'class') {
|
|
85
|
+
});<% } else if (typescriptConfig === 'class') { %><script lang="ts">
|
|
74
86
|
import { Vue, prop, Options } from 'vue-class-component';
|
|
75
87
|
|
|
76
88
|
class Props {
|
|
@@ -12,8 +12,29 @@
|
|
|
12
12
|
</div>
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
<% if (typescriptConfig === 'composition-setup') { %><script setup lang="ts">
|
|
16
|
+
import { computed, ref } from 'vue';
|
|
17
|
+
import { Todo, Meta } from './models';
|
|
18
|
+
|
|
19
|
+
interface Props {
|
|
20
|
+
title: string;
|
|
21
|
+
todos?: Todo[];
|
|
22
|
+
meta: Meta;
|
|
23
|
+
active: boolean;
|
|
24
|
+
}
|
|
25
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
26
|
+
todos: () => [],
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const clickCount = ref(0);
|
|
30
|
+
function increment() {
|
|
31
|
+
clickCount.value += 1;
|
|
32
|
+
return clickCount.value;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const todoCount = computed(() => props.todos.length);
|
|
36
|
+
<% } else if (typescriptConfig === 'composition') { %><script lang="ts">
|
|
37
|
+
import {
|
|
17
38
|
defineComponent,
|
|
18
39
|
PropType,
|
|
19
40
|
computed,
|
|
@@ -60,7 +81,8 @@ export default defineComponent({
|
|
|
60
81
|
setup(props) {
|
|
61
82
|
return { ...useClickCount(), ...useDisplayTodo(toRef(props, 'todos')) };
|
|
62
83
|
},
|
|
63
|
-
});<% } else if (typescriptConfig === 'options') {
|
|
84
|
+
});<% } else if (typescriptConfig === 'options') { %><script lang="ts">
|
|
85
|
+
import { defineComponent, PropType } from 'vue';
|
|
64
86
|
import { Todo, Meta } from './models';
|
|
65
87
|
|
|
66
88
|
export default defineComponent({
|
|
@@ -97,7 +119,8 @@ export default defineComponent({
|
|
|
97
119
|
return this.todos.length;
|
|
98
120
|
}
|
|
99
121
|
}
|
|
100
|
-
});<% } else if (typescriptConfig === 'class') {
|
|
122
|
+
});<% } else if (typescriptConfig === 'class') { %><script lang="ts">
|
|
123
|
+
import { Vue, prop } from 'vue-class-component';
|
|
101
124
|
import { Todo, Meta } from './models';
|
|
102
125
|
|
|
103
126
|
class Props {
|
|
@@ -45,8 +45,61 @@
|
|
|
45
45
|
</q-layout>
|
|
46
46
|
</template>
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
<% if (typescriptConfig === 'composition-setup') { %><script setup lang="ts">
|
|
49
|
+
import { ref } from 'vue';
|
|
50
|
+
import EssentialLink from 'components/EssentialLink.vue';
|
|
51
|
+
|
|
52
|
+
const essentialLinks = [
|
|
53
|
+
{
|
|
54
|
+
title: 'Docs',
|
|
55
|
+
caption: 'quasar.dev',
|
|
56
|
+
icon: 'school',
|
|
57
|
+
link: 'https://quasar.dev'
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
title: 'Github',
|
|
61
|
+
caption: 'github.com/quasarframework',
|
|
62
|
+
icon: 'code',
|
|
63
|
+
link: 'https://github.com/quasarframework'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
title: 'Discord Chat Channel',
|
|
67
|
+
caption: 'chat.quasar.dev',
|
|
68
|
+
icon: 'chat',
|
|
69
|
+
link: 'https://chat.quasar.dev'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
title: 'Forum',
|
|
73
|
+
caption: 'forum.quasar.dev',
|
|
74
|
+
icon: 'record_voice_over',
|
|
75
|
+
link: 'https://forum.quasar.dev'
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
title: 'Twitter',
|
|
79
|
+
caption: '@quasarframework',
|
|
80
|
+
icon: 'rss_feed',
|
|
81
|
+
link: 'https://twitter.quasar.dev'
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
title: 'Facebook',
|
|
85
|
+
caption: '@QuasarFramework',
|
|
86
|
+
icon: 'public',
|
|
87
|
+
link: 'https://facebook.quasar.dev'
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
title: 'Quasar Awesome',
|
|
91
|
+
caption: 'Community Quasar projects',
|
|
92
|
+
icon: 'favorite',
|
|
93
|
+
link: 'https://awesome.quasar.dev'
|
|
94
|
+
}
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
const leftDrawerOpen = ref(false)
|
|
98
|
+
|
|
99
|
+
function toggleLeftDrawer() {
|
|
100
|
+
leftDrawerOpen.value = !leftDrawerOpen.value
|
|
101
|
+
}<% } else if (typescriptConfig === 'composition') { %><script lang="ts">
|
|
102
|
+
import { defineComponent, ref } from 'vue';
|
|
50
103
|
import EssentialLink from 'components/EssentialLink.vue';
|
|
51
104
|
|
|
52
105
|
const linksList = [
|
|
@@ -112,7 +165,8 @@ export default defineComponent({
|
|
|
112
165
|
}
|
|
113
166
|
}
|
|
114
167
|
}
|
|
115
|
-
});<% } else if (typescriptConfig === 'options') {
|
|
168
|
+
});<% } else if (typescriptConfig === 'options') { %><script lang="ts">
|
|
169
|
+
import { defineComponent } from 'vue';
|
|
116
170
|
import EssentialLink from 'components/EssentialLink.vue';
|
|
117
171
|
|
|
118
172
|
const linksList = [
|
|
@@ -179,7 +233,7 @@ export default defineComponent({
|
|
|
179
233
|
this.leftDrawerOpen = !this.leftDrawerOpen
|
|
180
234
|
}
|
|
181
235
|
}
|
|
182
|
-
});<% } else if (typescriptConfig === 'class') {
|
|
236
|
+
});<% } else if (typescriptConfig === 'class') { %><script lang="ts">
|
|
183
237
|
import { Vue, Options } from 'vue-class-component';
|
|
184
238
|
import EssentialLink from 'components/EssentialLink.vue';
|
|
185
239
|
|
|
@@ -22,16 +22,19 @@
|
|
|
22
22
|
</div>
|
|
23
23
|
</template>
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
<% if (typescriptConfig === 'composition') {
|
|
25
|
+
<% if (typescriptConfig === 'composition-setup') { %><script setup lang="ts">
|
|
26
|
+
<% } else if (typescriptConfig === 'composition') { %><script lang="ts">
|
|
27
|
+
import { defineComponent } from 'vue';
|
|
27
28
|
|
|
28
29
|
export default defineComponent({
|
|
29
30
|
name: 'ErrorNotFound'
|
|
30
|
-
});<% } else if (typescriptConfig === 'options') {
|
|
31
|
+
});<% } else if (typescriptConfig === 'options') { %><script lang="ts">
|
|
32
|
+
import { defineComponent } from 'vue';
|
|
31
33
|
|
|
32
34
|
export default defineComponent({
|
|
33
35
|
name: 'ErrorNotFound'
|
|
34
|
-
});<% } else if (typescriptConfig === 'class') {
|
|
36
|
+
});<% } else if (typescriptConfig === 'class') { %><script lang="ts">
|
|
37
|
+
import { Vue } from 'vue-class-component';
|
|
35
38
|
|
|
36
39
|
export default class ErrorNotFound extends Vue {}<% } %>
|
|
37
40
|
</script>
|
|
@@ -9,8 +9,37 @@
|
|
|
9
9
|
</q-page>
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
<% if (typescriptConfig === 'composition-setup') { %><script setup lang="ts">
|
|
13
|
+
import { Todo, Meta } from 'components/models';
|
|
14
|
+
import ExampleComponent from 'components/ExampleComponent.vue';
|
|
15
|
+
import { ref } from 'vue';
|
|
16
|
+
|
|
17
|
+
const todos = ref<Todo[]>([
|
|
18
|
+
{
|
|
19
|
+
id: 1,
|
|
20
|
+
content: 'ct1'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 2,
|
|
24
|
+
content: 'ct2'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 3,
|
|
28
|
+
content: 'ct3'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 4,
|
|
32
|
+
content: 'ct4'
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 5,
|
|
36
|
+
content: 'ct5'
|
|
37
|
+
}
|
|
38
|
+
]);
|
|
39
|
+
const meta = ref<Meta>({
|
|
40
|
+
totalCount: 1200
|
|
41
|
+
});<% } else if (typescriptConfig === 'composition') { %><script lang="ts">
|
|
42
|
+
import { Todo, Meta } from 'components/models';
|
|
14
43
|
import ExampleComponent from 'components/ExampleComponent.vue';
|
|
15
44
|
import { defineComponent, ref } from 'vue';
|
|
16
45
|
|
|
@@ -45,7 +74,8 @@ export default defineComponent({
|
|
|
45
74
|
});
|
|
46
75
|
return { todos, meta };
|
|
47
76
|
}
|
|
48
|
-
});<% } else if (typescriptConfig === 'options') {
|
|
77
|
+
});<% } else if (typescriptConfig === 'options') { %><script lang="ts">
|
|
78
|
+
import { Todo, Meta } from 'components/models';
|
|
49
79
|
import ExampleComponent from 'components/ExampleComponent.vue';
|
|
50
80
|
import { defineComponent } from 'vue';
|
|
51
81
|
|
|
@@ -80,7 +110,7 @@ export default defineComponent({
|
|
|
80
110
|
};
|
|
81
111
|
return { todos, meta };
|
|
82
112
|
}
|
|
83
|
-
});<% } else if (typescriptConfig === 'class') {
|
|
113
|
+
});<% } else if (typescriptConfig === 'class') { %><script lang="ts">
|
|
84
114
|
import { Vue, Options } from 'vue-class-component'
|
|
85
115
|
import { Todo, Meta } from 'components/models';
|
|
86
116
|
import ExampleComponent from 'components/ExampleComponent.vue';
|
|
@@ -3,9 +3,28 @@ import { createI18n } from 'vue-i18n';
|
|
|
3
3
|
|
|
4
4
|
import messages from 'src/i18n';
|
|
5
5
|
|
|
6
|
+
export type MessageLanguages = keyof typeof messages;
|
|
7
|
+
// Type-define 'en-US' as the master schema for the resource
|
|
8
|
+
export type MessageSchema = typeof messages["en-US"];
|
|
9
|
+
|
|
10
|
+
// See https://vue-i18n.intlify.dev/guide/advanced/typescript.html#global-resource-schema-type-definition
|
|
11
|
+
/* eslint-disable @typescript-eslint/no-empty-interface */
|
|
12
|
+
declare module "vue-i18n" {
|
|
13
|
+
// define the locale messages schema
|
|
14
|
+
export interface DefineLocaleMessage extends MessageSchema {}
|
|
15
|
+
|
|
16
|
+
// define the datetime format schema
|
|
17
|
+
export interface DefineDateTimeFormat {}
|
|
18
|
+
|
|
19
|
+
// define the number format schema
|
|
20
|
+
export interface DefineNumberFormat {}
|
|
21
|
+
}
|
|
22
|
+
/* eslint-enable @typescript-eslint/no-empty-interface */
|
|
23
|
+
|
|
6
24
|
export default boot(({ app }) => {
|
|
7
|
-
const i18n = createI18n({
|
|
8
|
-
locale: 'en-US'
|
|
25
|
+
const i18n = createI18n<{ message: MessageSchema }, MessageLanguages>({
|
|
26
|
+
locale: 'en-US',<% if (typescriptConfig === 'composition' || typescriptConfig === 'composition-setup') { %>
|
|
27
|
+
legacy: false,<% } %>
|
|
9
28
|
messages,
|
|
10
29
|
});
|
|
11
30
|
|
|
@@ -8,6 +8,7 @@ module.exports = async function ({ scope, utils }) {
|
|
|
8
8
|
initial: 0,
|
|
9
9
|
choices: [
|
|
10
10
|
{ title: 'Composition API', value: 'composition', description: 'recommended' },
|
|
11
|
+
{ title: 'Composition API with <script setup>', value: 'composition-setup', description: 'recommended' },
|
|
11
12
|
{ title: 'Options API', value: 'options' },
|
|
12
13
|
{ title: 'Class-based (DEPRECATED; see https://github.com/quasarframework/quasar/discussions/11204)', value: 'class', disabled: true }
|
|
13
14
|
]
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { store } from 'quasar/wrappers'
|
|
2
2
|
import { createPinia } from 'pinia'
|
|
3
|
+
import { Router } from 'vue-router';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* When adding new properties to stores, you should also
|
|
7
|
+
* extend the `PiniaCustomProperties` interface.
|
|
8
|
+
* @see https://pinia.vuejs.org/core-concepts/plugins.html#typing-new-store-properties
|
|
9
|
+
*/
|
|
10
|
+
declare module 'pinia' {
|
|
11
|
+
export interface PiniaCustomProperties {
|
|
12
|
+
readonly router: Router;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
3
15
|
|
|
4
16
|
/*
|
|
5
17
|
* If not building with SSR mode, you can
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { store } from 'quasar/wrappers'
|
|
2
2
|
import { InjectionKey } from 'vue'
|
|
3
|
+
import { Router } from 'vue-router'
|
|
3
4
|
import {
|
|
4
5
|
createStore,
|
|
5
6
|
Store as VuexStore,
|
|
@@ -35,6 +36,13 @@ declare module '@vue/runtime-core' {
|
|
|
35
36
|
// provide typings for `useStore` helper
|
|
36
37
|
export const storeKey: InjectionKey<VuexStore<StateInterface>> = Symbol('vuex-key')
|
|
37
38
|
|
|
39
|
+
// Provide typings for `this.$router` inside Vuex store
|
|
40
|
+
declare module "vuex" {
|
|
41
|
+
export interface Store<S> {
|
|
42
|
+
readonly $router: Router;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
38
46
|
export default store(function (/* { ssrContext } */) {
|
|
39
47
|
const Store = createStore<StateInterface>({
|
|
40
48
|
modules: {
|
package/utils/index.js
CHANGED
|
@@ -59,8 +59,8 @@ module.exports.renderTemplate = function (templateDir, scope) {
|
|
|
59
59
|
const targetRelativePath = rawPath.split('/').map(name => {
|
|
60
60
|
// dotfiles are ignored when published to npm, therefore in templates
|
|
61
61
|
// we need to prefix them with an underscore (e.g. "_.gitignore")
|
|
62
|
-
// Also, some tools like ESLint
|
|
63
|
-
// we also prefix files like "package.json" too. (e.g. "
|
|
62
|
+
// Also, some tools like ESLint expect valid config files, therefore
|
|
63
|
+
// we also prefix files like "package.json" too. (e.g. "_package.json")
|
|
64
64
|
return name.startsWith('_')
|
|
65
65
|
? name.slice(1)
|
|
66
66
|
: name
|