MDRY

导航

2022年8月27日 #

vue——组件自定义事件

摘要: 一.什么是组件自定事件? 自定义事件:顾名思义就是自己定义的事件,包含事件名,事件回调等,定义好之后去给组件使用。也是一种组件的通信方式,适用于子组件==>父组件。 二.子组件怎么给父组件传值的? (1)通过props传值 (i)找到父组件,先定义一个接受子组件数据的函数,并存入我们的变量中 注意: 阅读全文

posted @ 2022-08-27 21:57 小懵丹儿 阅读(457) 评论(0) 推荐(1) 编辑

vue——webStorage

摘要: 1.存储内容大小一般支持5MB左右(不同浏览器可能还不一样) 2.浏览器端通过 Window.sessionStorage 和 Window.localStorage 属性来实现本地存储机制。 3.相关API: 例子: localStorage的用法 注意 localStorage.setItem( 阅读全文

posted @ 2022-08-27 19:56 小懵丹儿 阅读(38) 评论(0) 推荐(0) 编辑

vue——minix混入

摘要: 1.功能:可以把多个组件共用的配置提取成一个混入对象 2.使用方式: 第一步定义混合:mixin.js 第二步使用混入: 全局混入:main.js中 局部混入: 总结: vue中混入是实现类继承的重要方式。 minix会在引入文件 中进行 属性和方法的合并(混入)minix优先执行,相同字段名 熟悉 阅读全文

posted @ 2022-08-27 17:18 小懵丹儿 阅读(978) 评论(0) 推荐(0) 编辑

vue——props配置项

摘要: 1.props的功能:让组件接受外部传过来的数据 2.传递数据:外部组件 3.接受方式: 1.简单声明接受: 2.限制类接收: 3.接收的同时对数据进行限制类、限制必要性、指定默认值: 备注:props是只读的,Vue底层会监测你对props的修改,如果进行了修改,就会发出警告,若业务需求确实需要修 阅读全文

posted @ 2022-08-27 16:47 小懵丹儿 阅读(23) 评论(0) 推荐(0) 编辑

vue——ref属性

摘要: ref属性: 被用来给元素或子组件注册引用信息(id的替代者) 应用在html标签上获取的是真实DOM元素,应用在组件标签上是组件实例对象(vc) 使用方式: 打标识:<h1 ref="xxx">.....</h1> 或 <School ref="xxx"></School> $refs: 类型:O 阅读全文

posted @ 2022-08-27 16:15 小懵丹儿 阅读(39) 评论(0) 推荐(0) 编辑

Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value.

摘要: 在学习vue2的过程中遇到了这种问题: 在vue2.0中子组件触发改变值的时候vue组件会报错,例如: Avoid mutating a prop directly since the value will be overwritten whenever the parent component r 阅读全文

posted @ 2022-08-27 11:17 小懵丹儿 阅读(286) 评论(0) 推荐(0) 编辑

Property or method "value" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components

摘要: 报错如下: 这种情况是在template中或者方法中写了‘value’,但是在data中没有定义 阅读全文

posted @ 2022-08-27 11:13 小懵丹儿 阅读(178) 评论(0) 推荐(0) 编辑

vue使用组件<el-date-picker>报错:Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the

摘要: Vue使用element-ui组件库中的<el-data-picker>标签报错 报以下错误,最开始我以为是props通信的问题,但后来发现是版本出现问题导致的 解决办法:版本2.14.1的版本已经都不可以了需要更新版本2.15.8 阅读全文

posted @ 2022-08-27 11:06 小懵丹儿 阅读(434) 评论(0) 推荐(0) 编辑