From 6dd1b2e31e40bada9a2094d14bf779928b36d6ee Mon Sep 17 00:00:00 2001 From: pplokijuhyg <1162963624@qq.com> Date: Mon, 25 Nov 2019 08:43:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 ++- src/App.vue | 14 ++------------ src/main.js | 3 ++- src/router.js | 15 +++++++++++++++ yarn.lock | 5 +++++ 5 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 src/router.js diff --git a/package.json b/package.json index d3184b4..baab4c1 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ }, "dependencies": { "core-js": "^3.3.2", - "vue": "^2.6.10" + "vue": "^2.6.10", + "vue-router": "^3.1.3" }, "devDependencies": { "@vue/cli-plugin-babel": "^4.0.0", diff --git a/src/App.vue b/src/App.vue index fcc5662..52957e6 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,28 +1,18 @@ diff --git a/src/main.js b/src/main.js index 63eb05f..65c9d1a 100644 --- a/src/main.js +++ b/src/main.js @@ -1,8 +1,9 @@ import Vue from 'vue' import App from './App.vue' - +import router from "./router" Vue.config.productionTip = false new Vue({ render: h => h(App), + router }).$mount('#app') diff --git a/src/router.js b/src/router.js new file mode 100644 index 0000000..5e731dd --- /dev/null +++ b/src/router.js @@ -0,0 +1,15 @@ +import Vue from 'vue' +//1.导入路由组件vue-router +import Router from 'vue-router' +//2.调用vue-router +Vue.use(Router) + +const router=new Router({ + routes: [ + // { + // path: '/', + // component: Hello + // } + ] +}); +export default route; diff --git a/yarn.lock b/yarn.lock index 43cc5b6..66e155b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7938,6 +7938,11 @@ vue-loader@^15.7.0: vue-hot-reload-api "^2.3.0" vue-style-loader "^4.1.0" +vue-router@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-3.1.3.tgz#e6b14fabc0c0ee9fda0e2cbbda74b350e28e412b" + integrity sha512-8iSa4mGNXBjyuSZFCCO4fiKfvzqk+mhL0lnKuGcQtO1eoj8nq3CmbEG8FwK5QqoqwDgsjsf1GDuisDX4cdb/aQ== + vue-style-loader@^4.1.0: version "4.1.2" resolved "https://registry.npm.taobao.org/vue-style-loader/download/vue-style-loader-4.1.2.tgz#dedf349806f25ceb4e64f3ad7c0a44fba735fcf8"