From 46b145edb3122088ae6e281802591490f4fae713 Mon Sep 17 00:00:00 2001 From: taoya7 <569781231@qq.com> Date: Tue, 10 Oct 2023 16:33:29 +0800 Subject: [PATCH] fix: init --- .gitignore | 24 ++++++++++++++++++++++++ .vscode/extensions.json | 3 +++ README.md | 18 ++++++++++++++++++ bun.lockb | Bin 0 -> 52989 bytes index.html | 13 +++++++++++++ package.json | 21 +++++++++++++++++++++ public/vite.svg | 1 + src/App.vue | 7 +++++++ src/Home.tsx | 21 +++++++++++++++++++++ src/main.ts | 4 ++++ src/vite-env.d.ts | 1 + tsconfig.json | 25 +++++++++++++++++++++++++ tsconfig.node.json | 10 ++++++++++ vite.config.ts | 17 +++++++++++++++++ 14 files changed, 165 insertions(+) create mode 100644 .gitignore create mode 100644 .vscode/extensions.json create mode 100644 README.md create mode 100755 bun.lockb create mode 100644 index.html create mode 100644 package.json create mode 100644 public/vite.svg create mode 100644 src/App.vue create mode 100644 src/Home.tsx create mode 100644 src/main.ts create mode 100644 src/vite-env.d.ts create mode 100644 tsconfig.json create mode 100644 tsconfig.node.json create mode 100644 vite.config.ts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..c0a6e5a --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"] +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..ef72fd5 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# Vue 3 + TypeScript + Vite + +This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 ` + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..2695717 --- /dev/null +++ b/package.json @@ -0,0 +1,21 @@ +{ + "name": "vite-project", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vue-tsc && vite build", + "preview": "vite preview" + }, + "dependencies": { + "@vitejs/plugin-vue-jsx": "^3.0.2", + "vue": "^3.2.47" + }, + "devDependencies": { + "@vitejs/plugin-vue": "^4.1.0", + "typescript": "^5.0.2", + "vite": "^4.3.9", + "vue-tsc": "^1.4.2" + } +} diff --git a/public/vite.svg b/public/vite.svg new file mode 100644 index 0000000..e7b8dfb --- /dev/null +++ b/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..d76f168 --- /dev/null +++ b/src/App.vue @@ -0,0 +1,7 @@ + + + diff --git a/src/Home.tsx b/src/Home.tsx new file mode 100644 index 0000000..4a3a9b1 --- /dev/null +++ b/src/Home.tsx @@ -0,0 +1,21 @@ +import { defineComponent, Suspense } from "vue"; + +const Profile = defineComponent({ + async setup(){ + await new Promise((resolve)=>{setTimeout(()=>{resolve("success")}, 2000)}); + }, + render(props:any){ + console.log(props); + return ( +
+ 内容 +
+ ) + }, +}); +export default ()=> + {{ + default: , + fallback:

Loading...

+ }} +
\ No newline at end of file diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..01433bc --- /dev/null +++ b/src/main.ts @@ -0,0 +1,4 @@ +import { createApp } from 'vue' +import App from './App.vue' + +createApp(App).mount('#app') diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..f82888f --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "preserve", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"], + "references": [{ "path": "./tsconfig.node.json" }] +} diff --git a/tsconfig.node.json b/tsconfig.node.json new file mode 100644 index 0000000..42872c5 --- /dev/null +++ b/tsconfig.node.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "composite": true, + "skipLibCheck": true, + "module": "ESNext", + "moduleResolution": "bundler", + "allowSyntheticDefaultImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..5e9b4fb --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,17 @@ +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' +import vueJsx from '@vitejs/plugin-vue-jsx' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [ + vue(), + vueJsx({ + // options are passed on to @vue/babel-plugin-jsx + }), + ], + server: { + port: 3000, + host: '0.0.0.0' + }, +})