Skip to content

Commit 3efa749

Browse files
committed
docs(example): vue-project
1 parent 735db3b commit 3efa749

File tree

5 files changed

+36
-44
lines changed

5 files changed

+36
-44
lines changed

examples/vue-project/README.md

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,14 @@
11
# vue-project
22

3-
This template should help get you started developing with Vue 3 in Vite.
3+
使用 version-polling 的示例项目
44

5-
## Recommended IDE Setup
5+
## 安装npm包
66

7-
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
8-
9-
## Type Support for `.vue` Imports in TS
10-
11-
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
12-
13-
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
14-
15-
1. Disable the built-in TypeScript Extension
16-
1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
17-
2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
18-
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
19-
20-
## Customize configuration
21-
22-
See [Vite Configuration Reference](https://vitejs.dev/config/).
23-
24-
## Project Setup
25-
26-
```sh
27-
npm install
28-
```
29-
30-
### Compile and Hot-Reload for Development
31-
32-
```sh
33-
npm run dev
34-
```
35-
36-
### Type-Check, Compile and Minify for Production
37-
38-
```sh
39-
npm run build
7+
```bash
8+
# npm registry
9+
pnpm add version-polling@latest
10+
# local file
11+
pnpm add ../../
12+
# see
13+
pnpm list --json version-polling
4014
```

examples/vue-project/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"type-check": "vue-tsc --noEmit"
1111
},
1212
"dependencies": {
13+
"version-polling": "^1.3.3",
1314
"vue": "^3.2.47",
1415
"vue-router": "^4.1.6"
1516
},

examples/vue-project/pnpm-lock.yaml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/vue-project/src/main.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ import router from './router';
55
import './assets/main.css';
66

77
import { createVersionPolling } from 'version-polling';
8-
// 安装调试本地 version-polling 包
8+
9+
/**
10+
*
11+
* 调试version-polling
12+
*
13+
*/
914
createVersionPolling({
1015
// eventTriggerList: ['popstate'],
1116
pollingInterval: 5 * 1000,

examples/vue-project/vite.config.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
import { fileURLToPath, URL } from 'node:url'
1+
import { URL, fileURLToPath } from 'node:url';
22

3-
import { defineConfig } from 'vite'
4-
import vue from '@vitejs/plugin-vue'
5-
import vueJsx from '@vitejs/plugin-vue-jsx'
3+
import vue from '@vitejs/plugin-vue';
4+
import vueJsx from '@vitejs/plugin-vue-jsx';
5+
import { defineConfig } from 'vite';
66

77
// https://vitejs.dev/config/
88
export default defineConfig({
99
plugins: [vue(), vueJsx()],
1010
resolve: {
1111
alias: {
12-
'@': fileURLToPath(new URL('./src', import.meta.url))
13-
}
14-
}
15-
})
12+
'@': fileURLToPath(new URL('./src', import.meta.url)),
13+
},
14+
},
15+
build: {
16+
target: 'es2015',
17+
},
18+
});

0 commit comments

Comments
 (0)