This commit is contained in:
zazzaz 2020-07-21 18:37:38 +08:00
parent 70995def26
commit 1e981eadc9
7 changed files with 42 additions and 3 deletions

5
package-lock.json generated
View File

@ -2498,6 +2498,11 @@
"@vue/shared": "3.0.0-rc.2"
}
},
"vue-router": {
"version": "4.0.0-beta.2",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.0.0-beta.2.tgz",
"integrity": "sha512-+TvUCpxEhgSCssMTXdX4qei/YZN1kEt4nZoOySPLLUlAeEIlY3K1ps3hyCOeC1qYGCuSwaWuDmK/yi2d7W0sSg=="
},
"wcwidth": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz",

View File

@ -6,7 +6,8 @@
"build": "vite build"
},
"dependencies": {
"vue": "^3.0.0-rc.1"
"vue": "^3.0.0-rc.1",
"vue-router": "^4.0.0-beta.2"
},
"devDependencies": {
"vite": "^1.0.0-rc.1",

View File

@ -1,5 +1,11 @@
<template>
<el-button>Button</el-button>
<div id="app">
<router-view />
<div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/button">Button</router-link>
</div>
</div>
</template>
<script>

View File

@ -0,0 +1,9 @@
<template>
<el-button>button text</el-button>
</template>
<script>
export default {
}
</script>

View File

@ -1,8 +1,10 @@
import { createApp } from 'vue'
import { installAll } from './component.js'
import { installAll } from './component.ts'
import router from "./router.ts";
import './style/element-ui@2.13.2.css'
import App from './App.vue'
const app = createApp(App)
installAll(app)
app.use(router)
app.mount('#app')

16
src/router.ts Normal file
View File

@ -0,0 +1,16 @@
import { RouteRecordRaw, createRouter, createWebHistory } from "vue-router";
import Button from "./components/button/doc/index.vue";
const routes: Array<RouteRecordRaw> = [
{
path: "/button",
component: Button
}
];
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes
});
export default router;