随笔分类 - Vue
摘要:npm init vite-app <project-name> cd <project-name> npm install npm run dev
阅读全文
摘要:1.在动态组件中使用: <keep-alive :include="whiteList" :exclude="blackList" :max="amount"> <component :is="currentComponent"></component> </keep-alive> 2.在vue-r
阅读全文
摘要:<div class="customerdetails_tabs" v-if="isRouterAlive"></div> export default { provide(){ return{ reload:this.reload } }, data() { return { isRouterAl
阅读全文
摘要:在用vue-router 做单页应用的时候重复点击一个跳转的路由会出现报错 这个报错是重复路由引起的只需在注册路由组建后使用下方重写路由就可以 解决办法: const originalReplace = Router.prototype.replace; Router.prototype.repla
阅读全文
摘要:1.在router的index.js配置映射关系中添加meta:{title:'首页'}; { path:'/profile', component:Profile, meta:{ title:'个人' } 2、使用 router.beforeEach方法: router.beforeEach( (
阅读全文
摘要:1.在路由配置页面中引入组件。 2、在要对应的配置页面中添加映射关系: const routes = [ { path:'', //redirect重定向,默认打开的路径 redirect:'/home' }, { path:'/home', component:Home, children:[{
阅读全文
摘要:1.不使用路由懒加载: import Home from '../components/Home' import About from '../components/About' import User from '../components/User' 2、使用路由懒加载: //路由懒加载的方式加
阅读全文
摘要:1.在router配置映射关系的文件中 添加动态属性: 2、使用 router-link绑定动态路由属性; 3、在页面中获取路由的动态属性:
阅读全文
摘要:1.安装: npm install vue-router --save 2.在src目录下创建router文件夹,并创建index.js 路由的配置文件; 3.导入路由模块: //配置路由的相关信息; import Vue from 'vue' import VueRouter from 'vue-
阅读全文