Skip to content

Commit d01b262

Browse files
author
白唯
committed
init
0 parents  commit d01b262

18 files changed

+9531
-0
lines changed

.editorconfig

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[*.{js,jsx,ts,tsx,vue}]
2+
indent_style = space
3+
indent_size = 2
4+
trim_trailing_whitespace = true
5+
insert_final_newline = true

.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.DS_Store
2+
node_modules
3+
/dist
4+
5+
6+
# local env files
7+
.env.local
8+
.env.*.local
9+
10+
# Log files
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*
14+
pnpm-debug.log*
15+
16+
# Editor directories and files
17+
.idea
18+
.vscode
19+
*.suo
20+
*.ntvs*
21+
*.njsproj
22+
*.sln
23+
*.sw?

README.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# vue3
2+
3+
## Project setup
4+
```
5+
yarn install
6+
```
7+
8+
### Compiles and hot-reloads for development
9+
```
10+
yarn serve
11+
```
12+
13+
### Compiles and minifies for production
14+
```
15+
yarn build
16+
```
17+
18+
### Lints and fixes files
19+
```
20+
yarn lint
21+
```
22+
23+
### Customize configuration
24+
See [Configuration Reference](https://cli.vuejs.org/config/).

babel.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
presets: [
3+
'@vue/cli-plugin-babel/preset'
4+
]
5+
}

package.json

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"name": "vue3",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"serve": "vue-cli-service serve",
7+
"build": "vue-cli-service build",
8+
"lint": "vue-cli-service lint"
9+
},
10+
"dependencies": {
11+
"core-js": "^3.6.5",
12+
"vue": "^3.0.0-0",
13+
"vue-class-component": "^8.0.0-0",
14+
"vue-router": "^4.0.0-0",
15+
"vuex": "^4.0.0-0"
16+
},
17+
"devDependencies": {
18+
"@typescript-eslint/eslint-plugin": "^2.33.0",
19+
"@typescript-eslint/parser": "^2.33.0",
20+
"@vue/cli-plugin-babel": "~4.5.0",
21+
"@vue/cli-plugin-eslint": "~4.5.0",
22+
"@vue/cli-plugin-router": "~4.5.0",
23+
"@vue/cli-plugin-typescript": "~4.5.0",
24+
"@vue/cli-plugin-vuex": "~4.5.0",
25+
"@vue/cli-service": "~4.5.0",
26+
"@vue/compiler-sfc": "^3.0.0-0",
27+
"@vue/eslint-config-standard": "^5.1.2",
28+
"@vue/eslint-config-typescript": "^5.0.2",
29+
"eslint": "^6.7.2",
30+
"eslint-plugin-import": "^2.20.2",
31+
"eslint-plugin-node": "^11.1.0",
32+
"eslint-plugin-promise": "^4.2.1",
33+
"eslint-plugin-standard": "^4.0.0",
34+
"eslint-plugin-vue": "^7.0.0-0",
35+
"less": "^3.0.4",
36+
"less-loader": "^5.0.0",
37+
"typescript": "~3.9.3"
38+
},
39+
"eslintConfig": {
40+
"root": true,
41+
"env": {
42+
"node": true
43+
},
44+
"extends": [
45+
"plugin:vue/vue3-essential",
46+
"@vue/standard",
47+
"@vue/typescript/recommended"
48+
],
49+
"parserOptions": {
50+
"ecmaVersion": 2020
51+
},
52+
"rules": {}
53+
},
54+
"browserslist": [
55+
"> 1%",
56+
"last 2 versions",
57+
"not dead"
58+
]
59+
}

public/favicon.ico

4.19 KB
Binary file not shown.

public/index.html

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
8+
<title><%= htmlWebpackPlugin.options.title %></title>
9+
</head>
10+
<body>
11+
<noscript>
12+
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
13+
</noscript>
14+
<div id="app"></div>
15+
<!-- built files will be auto injected -->
16+
</body>
17+
</html>

src/App.vue

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<template>
2+
<div id="app">
3+
<div id="nav">
4+
<router-link to="/">Home</router-link> |
5+
<router-link to="/about">About</router-link>
6+
</div>
7+
<router-view/>
8+
</div>
9+
</template>
10+
11+
<style lang="less">
12+
#app {
13+
font-family: Avenir, Helvetica, Arial, sans-serif;
14+
-webkit-font-smoothing: antialiased;
15+
-moz-osx-font-smoothing: grayscale;
16+
text-align: center;
17+
color: #2c3e50;
18+
}
19+
20+
#nav {
21+
padding: 30px;
22+
23+
a {
24+
font-weight: bold;
25+
color: #2c3e50;
26+
27+
&.router-link-exact-active {
28+
color: #42b983;
29+
}
30+
}
31+
}
32+
</style>

src/assets/logo.png

6.69 KB
Loading

src/components/HelloWorld.vue

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<template>
2+
<div class="hello">
3+
<h1>{{ msg }}</h1>
4+
<p>
5+
For a guide and recipes on how to configure / customize this project,<br>
6+
check out the
7+
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
8+
</p>
9+
<h3>Installed CLI Plugins</h3>
10+
<ul>
11+
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
12+
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li>
13+
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex" target="_blank" rel="noopener">vuex</a></li>
14+
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
15+
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-typescript" target="_blank" rel="noopener">typescript</a></li>
16+
</ul>
17+
<h3>Essential Links</h3>
18+
<ul>
19+
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
20+
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
21+
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
22+
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
23+
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
24+
</ul>
25+
<h3>Ecosystem</h3>
26+
<ul>
27+
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
28+
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
29+
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
30+
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
31+
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
32+
</ul>
33+
</div>
34+
</template>
35+
36+
<script lang="ts">
37+
import { Options, Vue } from 'vue-class-component'
38+
39+
@Options({
40+
props: {
41+
msg: String
42+
}
43+
})
44+
export default class HelloWorld extends Vue {
45+
msg!: string
46+
}
47+
</script>
48+
49+
<!-- Add "scoped" attribute to limit CSS to this component only -->
50+
<style scoped lang="less">
51+
h3 {
52+
margin: 40px 0 0;
53+
}
54+
ul {
55+
list-style-type: none;
56+
padding: 0;
57+
}
58+
li {
59+
display: inline-block;
60+
margin: 0 10px;
61+
}
62+
a {
63+
color: #42b983;
64+
}
65+
</style>

src/main.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { createApp } from 'vue'
2+
import App from './App.vue'
3+
import router from './router'
4+
import store from './store'
5+
6+
createApp(App).use(store).use(router).mount('#app')

src/router/index.ts

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
2+
import Home from '../views/Home.vue'
3+
4+
const routes: Array<RouteRecordRaw> = [
5+
{
6+
path: '/',
7+
name: 'Home',
8+
component: Home
9+
},
10+
{
11+
path: '/about',
12+
name: 'About',
13+
// route level code-splitting
14+
// this generates a separate chunk (about.[hash].js) for this route
15+
// which is lazy-loaded when the route is visited.
16+
component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
17+
}
18+
]
19+
20+
const router = createRouter({
21+
history: createWebHashHistory(),
22+
routes
23+
})
24+
25+
export default router

src/shims-vue.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
declare module '*.vue' {
2+
import { defineComponent } from 'vue'
3+
const component: ReturnType<typeof defineComponent>
4+
export default component
5+
}

src/store/index.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { createStore } from 'vuex'
2+
3+
export default createStore({
4+
state: {
5+
},
6+
mutations: {
7+
},
8+
actions: {
9+
},
10+
modules: {
11+
}
12+
})

src/views/About.vue

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<template>
2+
<div class="about">
3+
<h1>This is an about page</h1>
4+
</div>
5+
</template>

src/views/Home.vue

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<template>
2+
<div class="home">
3+
<img alt="Vue logo" src="../assets/logo.png">
4+
<HelloWorld msg="Welcome to Your Vue.js + TypeScript App"/>
5+
</div>
6+
</template>
7+
8+
<script lang="ts">
9+
import { Options, Vue } from 'vue-class-component'
10+
import HelloWorld from '@/components/HelloWorld.vue' // @ is an alias to /src
11+
12+
@Options({
13+
components: {
14+
HelloWorld
15+
}
16+
})
17+
export default class Home extends Vue {}
18+
</script>

tsconfig.json

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"compilerOptions": {
3+
"target": "esnext",
4+
"module": "esnext",
5+
"strict": true,
6+
"jsx": "preserve",
7+
"importHelpers": true,
8+
"moduleResolution": "node",
9+
"experimentalDecorators": true,
10+
"skipLibCheck": true,
11+
"esModuleInterop": true,
12+
"allowSyntheticDefaultImports": true,
13+
"sourceMap": true,
14+
"baseUrl": ".",
15+
"types": [
16+
"webpack-env"
17+
],
18+
"paths": {
19+
"@/*": [
20+
"src/*"
21+
]
22+
},
23+
"lib": [
24+
"esnext",
25+
"dom",
26+
"dom.iterable",
27+
"scripthost"
28+
]
29+
},
30+
"include": [
31+
"src/**/*.ts",
32+
"src/**/*.tsx",
33+
"src/**/*.vue",
34+
"tests/**/*.ts",
35+
"tests/**/*.tsx"
36+
],
37+
"exclude": [
38+
"node_modules"
39+
]
40+
}

0 commit comments

Comments
 (0)