
Vue
vue感想
quietness_1
帅就一个字,我再说一次
展开
-
Cannot find module ‘@/view/function () { vue的addRoutes报错问题
vue的addRoutes报错原创 2023-03-02 14:21:58 · 903 阅读 · 0 评论 -
【vue路由跳转外部链接】
vue-router跳转外部链接原创 2022-07-11 14:09:56 · 6444 阅读 · 0 评论 -
vue3的使用
老方法,上一个list,c+v后快速锁定稳定:vue3通过ref获取子组件里面的方法vue3改变数组不生效vue3中使用store1、vue3通过ref获取子组件里面的方法(其实就是状态监控一下,你看看自己setup中retrun或者**ref()**没,就这两个)<div ref="bianliang"></div>setup(){ let bianliang = ref() return { bianliang }}2、vue3改变数组不生效原创 2022-03-26 11:49:48 · 1138 阅读 · 0 评论 -
vue2项目改造成Ts
ps:研究阶段一代版本:(无法修改main.js因为,main.js是vue-cli的启动文件,需要修改配置了)1、主要注意Ts的版本,install一下 "ts-loader": "^4.4.2", "tslint": "^6.1.3", "tslint-config-standard": "^9.0.0", "tslint-loader": "^3.5.4", "typescript": "^3.5.2", "vue-property-decorator": "^9.1.2", "v原创 2022-02-07 15:06:25 · 2280 阅读 · 0 评论 -
vue2.0中使用async和await把两个请求按顺序执行
async handleSearch() {let res = await this.service.findPage(this.searchInfo)}1、await后面跟一个function函数,否则babel会报错(‘await’ is only allowed within async functions)2、原创 2022-01-16 09:51:44 · 3408 阅读 · 0 评论 -
vue2获取访问vuex分模块的数据
1、传统方法this.$store.state['模块名']['属性名']2、mapState方法:import { mapState } from 'vuex'computed: { // ... ...mapState({ list: state => state.city.list }) }触发其他模块的action1、this.$store.dispatch('模块名/属性名', opts)...原创 2021-11-15 17:51:42 · 2941 阅读 · 0 评论 -
vue2点击事件携带本身+参数
记得是这样<div @click="fn($event,'1111')">确定</div>fn(a,b){console.log(a,b)}原创 2021-10-23 16:32:04 · 829 阅读 · 0 评论 -
Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-
自己直接给props复制大概意思是:通过props传递给子组件的show,不能在子组件内部修改props中的show值。原创 2021-04-16 10:16:20 · 1202 阅读 · 0 评论 -
vue2中使用ehcarts的基本
所有的都是三步:1、获取dom(有宽高)2、配置项话不多说,上代码:1、npm install echarts -S2、// 引入echartsimport echarts from 'echarts'Vue.prototype.$echarts = echarts3、<div id="myChart" :style="{width: '300px', height: '300px'}"></div>4、export default { name: 'hel原创 2020-05-19 07:57:05 · 359 阅读 · 0 评论 -
Vue创建一个新的项目、vue add 和npm install区别
卸载1.x和2.x1、npm uninstall vue-cli -g 全局安装2、npm install -g @vue/cli创建项目:1、vue create 项目名2、 (1. default (babel, eslint) 默认预设配置 babel, eslint (2. Manually select features 手动选择配置enter后,进入手动选择配置 ,有以下Installed CLI Plugins选项(注:空格单选,a全选,i反向全选)(1原创 2020-09-01 14:12:53 · 12923 阅读 · 0 评论 -
vue数据更新页面不刷新问题
可能会出现两种情况:1、替换其中某个数据2、替换掉整个数组 || 对象第一种:Vue官方文档给我们提供了两种方法:Vue.set()和this.set()区别:Vue.set可以设置实例创建之后添加的属性,而this.set()区别:Vue.set 可以设置实例创建之后添加的属性,而this.set()区别:Vue.set可以设置实例创建之后添加的属性,而this.set只能设置实例创建后存在的属性最常见错误:1、通过数组索引修改数组元素2、修改数组长度时3、Vue 不能检测对象属性的添加原创 2020-12-07 10:18:24 · 3549 阅读 · 4 评论 -
vue清除指定缓存的方法(三个)
一、 路由方法,可以小改在main.js文件中Vue.mixin({ beforeRouteLeave:function(to, from, next){ console.log('111111111111111触发了') console.log(this) // 确定是点击关闭按钮过来的 关闭的路由时可缓存的 if(from.meta.reload&&from.meta.keepAlive&&this.$vnode.comp原创 2020-09-30 09:21:21 · 28285 阅读 · 3 评论 -
vue-cli创建的webpack工程中引用ExtractTextPlugin导致css背景图设置无效的解决方法
当我们用vue-cli创建项目后,如果在我们的template模板文件中的css样式设置中,有设置了background-image的属性,并且url值传入的是相对路径,那么当我们在打包生产代码时,webpack调用ExtractTextPlugin后生成的代码中,将没办法获取到正确的图片url,因为图片都被打包到静态文件中去了。解决方法:1、在build/util.js中配置publicPath:“…/…/”, 这样可以修正静态资源的url if (options.extract) {原创 2020-09-21 10:40:53 · 812 阅读 · 0 评论 -
Vue的性能优化
首屏加载过慢优化:分析工具贴一波:vuecli 2.x自带了分析工具,只要运行 npm run build --report如果是 vuecli 3的话,先安装插件cnpm intall webpack-bundle-analyzer –save-dev然后在 vue.config.js中对 webpack进行配置再运行 npm run build --report会在浏览器打开一个项目打包的情况图,便于直观地比较各个 bundle文件的大小1、路由的问题,简单带过import Show原创 2020-09-21 09:27:03 · 431 阅读 · 0 评论