From 1e981eadc9cddeabaa3d0b9698e4c4c0364769ce Mon Sep 17 00:00:00 2001 From: zazzaz Date: Tue, 21 Jul 2020 18:37:38 +0800 Subject: [PATCH] update --- package-lock.json | 5 +++++ package.json | 3 ++- src/App.vue | 8 +++++++- src/{component.js => component.ts} | 0 src/components/button/doc/index.vue | 9 +++++++++ src/main.js | 4 +++- src/router.ts | 16 ++++++++++++++++ 7 files changed, 42 insertions(+), 3 deletions(-) rename src/{component.js => component.ts} (100%) create mode 100644 src/components/button/doc/index.vue create mode 100644 src/router.ts diff --git a/package-lock.json b/package-lock.json index 7e7995dd8e..24da34d4f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 3657b87468..1ce2943dd7 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/App.vue b/src/App.vue index 0e9019f667..c7157bba29 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,5 +1,11 @@ diff --git a/src/main.js b/src/main.js index b2adb7f282..7f13055067 100644 --- a/src/main.js +++ b/src/main.js @@ -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') diff --git a/src/router.ts b/src/router.ts new file mode 100644 index 0000000000..1017e6a5db --- /dev/null +++ b/src/router.ts @@ -0,0 +1,16 @@ +import { RouteRecordRaw, createRouter, createWebHistory } from "vue-router"; +import Button from "./components/button/doc/index.vue"; + +const routes: Array = [ + { + path: "/button", + component: Button + } +]; + +const router = createRouter({ + history: createWebHistory(process.env.BASE_URL), + routes +}); + +export default router; \ No newline at end of file