目录
安装router
- 在vscode中来到你的项目文件夹中
- 在终端中执行命令安装router:npm i vue-router -D
- 等待下载安装
- 安装好以后,在项目目录的src目录内,新建目录 modules 用于存放插件模块
- 在moudules内新建路由配置文件 route.js
- 里面写如下内容:
import { createRouter, createWebHistory } from "vue-router"
const router = createRouter({
routes: [],
history: createWebHistory()
})
export default router
修改main.js
- 导入router : import router from "./modules/router"
- 使用router : app.use(router)
- 最终main.js文件内容:
import { createApp } from 'vue'
import App from './App.vue'
import router from "./modules/router"
const app = createApp(App)
app.use(router)
app.mount('#app')
创建pages
- 在src目录下,新建文件夹pages,用于存放页面
- 在里面新建2个示例页面:hello.vue,home.vue
- hello.vue
- -
- home.vue
- 在App.vue中使用路由,修改App.vue:
<template>
<router-view></router-view>
</template>
在router.js中配置页面
- 上面两个页面(hello.vue和home.vue)新建后路由是不知道的,我们需要在配置文件router.js中告诉它,因此需要修改router.js
- 在routes数组中增加对应页面的配置:
{
name:"主页",
component: () => import('../pages/home.vue')
},
{
name:"欢迎",
path:"/hello",
component: () => import('../pages/hello.vue')
}
- -
- name:页面名称,随意
- path:在浏览器访问的时候的路径
- component:导入访问的页面文件
- 由于第一个就是默认的主页,所以不需要写path
- 访问第二个的浏览器路径就是:http://localhost:3000/hello
- router.js总体代码:
import { createRouter, createWebHistory } from "vue-router"
const router = createRouter({
routes: [
{
name:"主页",
component: () => import('../pages/home.vue')
},
{
name:"欢迎",
path:"/hello",
component: () => import('../pages/hello.vue')
}
],
history: createWebHistory()
})
export default router
- 到这里基本就配置完成了,运行项目看看:npm run dev
- 主页:
- 欢迎页:
配置文件路由
当我们增加页面时,总要在router中配置一下,一旦页面多起来就很麻烦,所以可以安装文件路由,也就是以文件夹pages内的文件结构自动作为访问路径。
- 安装文件路由插件
- npm i -D vite-plugin-pages
- 在vite.config.js中增加配置:
import Pages from "vite-plugin-pages"
export default defineConfig({
plugins:[
//...
Pages(),
]
})
- 修改后的vite.config.js :
- 修改router.js
- 从pages文件夹中导入
- 去掉routes内容
import { createRouter, createWebHistory } from "vue-router"
import routes from "~pages";
const router = createRouter({
routes,
history: createWebHistory()
})
export default router
- 到这里就完成了,但要注意的是,页面里主页不是home.vue了,默认的是index.vue,由于我们示例中并没有这个文件,因此访问http://localhost:3000就会报警告。而访问原来的home.vue就需要改为http://localhost:3000/home
Добрый день!
Купить диплом любого университета.
kilcoynelilacfarm.com/component/comprofiler/pluginclass/cbblogs?action=blogs&func=show&id=394
best online pharmacies in mexico mexico drug stores pharmacies purple pharmacy mexico price list
purple pharmacy mexico price list: mexican border pharmacies shipping to usa – buying from online mexican pharmacy
buying prescription drugs in mexico online: п»їbest mexican online pharmacies – mexican online pharmacies prescription drugs
buying prescription drugs in mexico online: reputable mexican pharmacies online – mexican online pharmacies prescription drugs
mexico drug stores pharmacies: п»їbest mexican online pharmacies – purple pharmacy mexico price list
Привет, друзья!
Официальная покупка школьного аттестата с упрощенным обучением в Москве
muktipotro.com/22141
Рады оказать помощь!.
Здравствуйте!
Как получить диплом техникума с упрощенным обучением в Москве официально
diplomman.ru
purple pharmacy mexico price list: buying prescription drugs in mexico online – medication from mexico pharmacy
best online pharmacies in mexico: purple pharmacy mexico price list – mexico drug stores pharmacies
pharmacies in mexico that ship to usa: medication from mexico pharmacy – mexico drug stores pharmacies
mexico drug stores pharmacies: mexico pharmacies prescription drugs – mexico drug stores pharmacies
mexican mail order pharmacies: buying from online mexican pharmacy – reputable mexican pharmacies online
pharmacies in mexico that ship to usa pharmacies in mexico that ship to usa medicine in mexico pharmacies
buying prescription drugs in mexico: reputable mexican pharmacies online – mexican online pharmacies prescription drugs
световое оборудование для актового зала световое оборудование для актового зала .
оборудование для переговорных оборудование для переговорных .
best online pharmacies in mexico: mexican online pharmacies prescription drugs – mexican rx online
Оборудование актовых залов https://oborudovanie-aktovogo-zala.ru/ .
mexican online pharmacies prescription drugs п»їbest mexican online pharmacies medication from mexico pharmacy
– Free Games Feature Slotastic has been on the scene for quite some time now and so far, there were no complaints from LCB members regarding the way this venue conducts its business. Its portfolio is powered solely by RealTime and is not very large. However, this doesn’t mean it’s not diverse. Sorry, your browser doesn’t support canvas. Please try another. New post, Nina started a new topic: Top 4 Winners for the Week 17th June 2024 – Free Games Feature Six fresh bonuses available every month New post, Nina started a new topic: Top 4 Winners for the Week 17th June 2024 When it comes to choosing an online casino, it’s important to find a platform that not only offers a great gaming experience but also prioritizes your safety and security. That’s where Inclave casinos come in. With their exclusive and private nature, all Inclave casinos offer a unique and luxurious gaming experience that’s hard to beat. But with so many options out there, how do you choose the best one for you? Here are some top criteria to consider:
https://chillspot1.com/user/deersglarealet1975
©2024 NoDepositz.gg All Rights ReservedTerms and Conditions If you’re not familiar with the concept of sweepstakes gaming online, it may never have occurred to you that you can play Vegas-style slot machine games without spending your own money. But I’m here to tell you that this is entirely possible, and it’s all thanks to the latest no deposit sweep slots casinos. Simply put, Planet 7 has the most amazing no deposit bonus codes in the universe. All you do is register, enter your free Planet 7 no deposit bonus code, and start playing to win. No risk, only possible rewards. You’re gambling with the casino’s money but you keep the cash you win (please check the details of the offer as certain restrictions may apply)! What could be better, right? The casino pays, you play! When it comes to casino bonuses, deposit bonuses are pretty much at the core of any respectable online casino. They are a casino operator’s favorite way of encouraging new and frequent players alike to join in on the fun on the casino floor and start playing the offered casino games for real money. The concept is straight-forward, a player makes a deposit via their chosen method of payment for a set amount. If the minimum is $50, for example, the player must deposit at least the minimum amount in order to utilize the benefits of the bonus, which can be either cash or free spins games.
buying prescription drugs in mexico mexico drug stores pharmacies mexican pharmacy
помещение для переговоров https://www.oborudovanie-peregovornyh-komnat.ru .
purple pharmacy mexico price list: mexican mail order pharmacies – medication from mexico pharmacy
medication from mexico pharmacy: buying prescription drugs in mexico – buying prescription drugs in mexico
mexican mail order pharmacies: mexican rx online – pharmacies in mexico that ship to usa
оборудование для актовых залов оборудование для актовых залов .
female viagra online order
baclofen 30 mg tablet
переговорные комнаты под ключ переговорные комнаты под ключ .
mexico drug stores pharmacies buying prescription drugs in mexico online mexican mail order pharmacies
mexico pharmacies prescription drugs: mexican border pharmacies shipping to usa – mexican border pharmacies shipping to usa
medicine in mexico pharmacies: medicine in mexico pharmacies – mexican border pharmacies shipping to usa
mexican rx online: mexico drug stores pharmacies – pharmacies in mexico that ship to usa
mexican border pharmacies shipping to usa: purple pharmacy mexico price list – п»їbest mexican online pharmacies
Оборудование актовых залов oborudovanie-aktovogo-zala.ru .
purple pharmacy mexico price list: medicine in mexico pharmacies – pharmacies in mexico that ship to usa
mexican pharmaceuticals online mexico drug stores pharmacies mexico pharmacies prescription drugs
best online pharmacies in mexico: medication from mexico pharmacy – mexican rx online
оснащение переговорных комнат оснащение переговорных комнат .
amoxicillin trihydrate
mexican mail order pharmacies: mexican rx online – mexican pharmaceuticals online
purple pharmacy mexico price list: mexican border pharmacies shipping to usa – mexican mail order pharmacies
п»їbest mexican online pharmacies mexican online pharmacies prescription drugs best online pharmacies in mexico
Привет!
Приобрести диплом университета.
logan.in.ua/people/user/7276/blog/7929
buying from online mexican pharmacy reputable mexican pharmacies online reputable mexican pharmacies online
Добрый день!
Купить документ о получении высшего образования вы имеете возможность в нашей компании в Москве.
diploms-x.com/kupit-diplom-perm
mexico drug stores pharmacies: mexican rx online – mexican border pharmacies shipping to usa
Добрый день!
Официальная покупка школьного аттестата с упрощенным обучением в Москве
remotebillpay.com/купить-диплом-о-высшем-образовании-ре
Рады помочь!.
buying prescription drugs in mexico: buying prescription drugs in mexico – mexican mail order pharmacies