2019年11月3日
摘要: 在项目很大的时候,首页会一次导入所有页面与组件,可以使用懒加载实现项目的优化,但项目很小,不推荐使用,项目小,分开后的懒加载会发多次请求,带来更多的性能缺陷 路由写法 //假设components下有一个home.vue,需要在路由页面引入 new Router({ routes:[{ path:' 阅读全文
posted @ 2019-11-03 19:29 随心的博客 阅读(2246) 评论(0) 推荐(0)
摘要: 可以在vue路由新增scrollBehavior,控制跳转页面高度 import Router from 'vue-router' new Router({ scrollBehavior (to, from, savedPosition) { return { x: 0, y: 0 } } }) 阅读全文
posted @ 2019-11-03 19:19 随心的博客 阅读(1732) 评论(0) 推荐(0)
摘要: 在方法实现上,使用vue中axios方法封装实现例子 import axios from 'axios' //导入axios 包 axios.defaults.baseUrl="localhost:8080"; axios.interceptors.request.use((config)=>{ l 阅读全文
posted @ 2019-11-03 19:05 随心的博客 阅读(1155) 评论(0) 推荐(0)
摘要: 一、vue3.0 webpack设置别名 在vue根目录下新建一个文件,命名为vue.config.js(vue官方配置). 首先在项目根目录下,安装path(npm install path || yarn add path) const path = require('path'); funct 阅读全文
posted @ 2019-11-03 18:43 随心的博客 阅读(1010) 评论(0) 推荐(0)