-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
7,507 additions
and
456 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<template> | ||
<div> | ||
<h3>{{ msg }}, {{ name }}</h3> | ||
<button @click="inc"> | ||
Inc | ||
</button> | ||
<div>{{ count }} x 2 = {{ doubled }}</div> | ||
<button @click="dec()" v-html="decText" /> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const props = withDefaults(defineProps<{ msg: string; name: string | number }>(), { msg: 'Hello' }) | ||
const emit = defineEmits(['update']) | ||
const count = ref(0) | ||
const doubled = computed(() => count.value * 2) | ||
function inc() { | ||
count.value += 1 | ||
} | ||
function dec() { | ||
count.value += 1 | ||
} | ||
const decText = '<b>Dec</b>' | ||
watch(count, value => emit('update', value)) | ||
</script> | ||
|
||
<script lang="ts"> | ||
export default { | ||
name: 'App' | ||
} | ||
</script> |
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,12 @@ | ||
export default { | ||
buildModules: [ | ||
// we disable the type check and left it to `vue-tsc` | ||
['@nuxt/typescript-build', { typeCheck: false }], | ||
// @vue/composition-api support | ||
'@nuxtjs/composition-api/module', | ||
// <script setup> transformer | ||
'unplugin-vue2-script-setup/nuxt', | ||
// auto import | ||
['unplugin-auto-import/nuxt', { imports: ['@vue/composition-api'] }], | ||
], | ||
} |
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,24 @@ | ||
{ | ||
"name": "nuxt-example", | ||
"private": true, | ||
"scripts": { | ||
"dev": "nuxt", | ||
"build": "vue-tsc --noEmit && nuxt build", | ||
"start": "nuxt start", | ||
"generate": "nuxt generate" | ||
}, | ||
"dependencies": { | ||
"core-js": "^3.15.1", | ||
"nuxt": "^2.15.7", | ||
"vue": "^2.6.14" | ||
}, | ||
"devDependencies": { | ||
"@nuxt/types": "^2.15.8", | ||
"@nuxt/typescript-build": "^2.1.0", | ||
"@nuxtjs/composition-api": "^0.27.0", | ||
"@vue/runtime-dom": "^3.2.4", | ||
"vue-tsc": "^0.3.0", | ||
"unplugin-vue2-script-setup": "^0.4.0", | ||
"unplugin-auto-import": "workspace:*" | ||
} | ||
} |
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,13 @@ | ||
<template> | ||
<div> | ||
<hello-world name="Vue 2" @update="onUpdate" /> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import HelloWorld from '../components/HelloWorld.vue' | ||
function onUpdate(e: any) { | ||
console.log(e) | ||
} | ||
</script> |
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,35 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2018", | ||
"module": "ESNext", | ||
"moduleResolution": "Node", | ||
"lib": [ | ||
"ESNext", | ||
"ESNext.AsyncIterable", | ||
"DOM" | ||
], | ||
"esModuleInterop": true, | ||
"skipLibCheck": true, | ||
"allowJs": true, | ||
"sourceMap": true, | ||
"strict": true, | ||
"noEmit": true, | ||
"baseUrl": ".", | ||
"paths": { | ||
"~/*": [ | ||
"./*" | ||
], | ||
"@/*": [ | ||
"./*" | ||
] | ||
}, | ||
"types": [ | ||
"@types/node", | ||
"@nuxt/types", | ||
"unplugin-vue2-script-setup/types" | ||
] | ||
}, | ||
"exclude": [ | ||
"node_modules" | ||
] | ||
} |
Oops, something went wrong.