2.vue_bug

1.vue_bug

1.1Error in render: "TypeError: Cannot read property '0' of undefined"”渲染错误问题

问题

报错

问题源头

解决方案
1.模板在渲染时候,读取对象中的某个对象的属性值时,这个对象不存在,
2.说通俗点就是三层表达式a.b.c,在对象a中没有对象b,那么读取对象a.b.c中的值,自然会报错。
3.如果是两层表达式a.b则不会报错,返回的是undefined。

解决方案

1.在外层添加v-if判断条件
2.注意,不能用v-show,v-show的机制是加载后,根据条件判断是否显示

2.props默认值为对象或数组

https://blog.csdn.net/l1996729/article/details/106354377/

3.vue中window.onresize不生效

https://www.cnblogs.com/wangweizhang/p/12874679.html
https://blog.csdn.net/asm35548/article/details/101797302

4.vue自带属性不用箭头函数

运行结果

5.点击同一个链接多次时报错误

点击同一个链接多次时报的错误解决方案
http://www.10qianwan.com/articledetail/619420.html
采用方案2(主要原因是因为我们现在vue-router版本高于3.0.7)
https://www.cnblogs.com/rever/p/11577322.html

运行结果
router/index.js

import Router from 'vue-router'

const originalPush = Router.prototype.push
Router.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
  return originalPush.call(this, location).catch(err => err)
}

6.components公共组件引入其他公共组件

不用@

import myLoading from './Loading.vue'

7.options should NOT have additional properties

https://segmentfault.com/q/1010000018743301

8.Vue大型表单数据导致el-input输入卡顿解决方案

https://blog.csdn.net/cindy647/article/details/114400517

9.import { More } from '@/components/jsDom/more/index.js'

未删除干净

10.vue 组件之间的循环引用

https://blog.csdn.net/yxm_136452789/article/details/122919649

11.Vue动态设置img的src不生效

https://blog.csdn.net/m0_73334325/article/details/130574162

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 概要 64学时 3.5学分 章节安排 电子商务网站概况 HTML5+CSS3 JavaScript Node 电子...
    阿啊阿吖丁阅读 9,341评论 0 3
  • "use strict";function _classCallCheck(e,t){if(!(e instanc...
    久些阅读 2,054评论 0 2
  • 1.埋点是做什么的 2.如何进行埋点 3.埋点方案的设计 近期常被问到这个问题,我担心我的答案会将一些天真烂漫的孩...
    lxg阅读 2,029评论 0 1
  • 不支持上传文件,所以就复制过来了。作者信息什么的都没删。对前端基本属于一窍不通,所以没有任何修改,反正用着没问题就...
    全栈在路上阅读 1,999评论 0 2
  • 函数和对象 1、函数 1.1 函数概述 函数对于任何一门语言来说都是核心的概念。通过函数可以封装任意多条语句,而且...
    道无虚阅读 4,664评论 0 5