Vue
你的 Alex
弱者才会一蹶不振,我要的是逆风翻盘
展开
-
组件传值时报错
组件传值时报错 Invalid prop: type check failed for prop “duration”. Expected Number with value 1000, got String with value “1000”. 这是因为在组件中写的默认值是一个Number 类型,传值的时候得到的是一个字符串, 这种情况有可能是咋父组件中传值的时候 <ImageLoader src="http://tiebapic.baidu.com/forum/w%3D580%3B/s原创 2021-06-23 17:02:08 · 510 阅读 · 0 评论 -
element-ui 表单错误:Cannot read property ‘validate‘ of undefined“
element-ui 表单错误:Cannot read property ‘validate’ of undefined" <el-form :model="card_form" ref="card_form" :rules="myrules"> 。。。 </el-form> <div slot="footer" class="dialog-footer"> <el-button @click="abrogateAdd('addform')">取 消&原创 2021-04-13 22:20:19 · 290 阅读 · 0 评论 -
限制input 输入框 只能输入数字
Vue限制input输入框限制输入为数字 在项目中会遇到表单填写的时候在input中输入纯数字的情况,这个时候需要我们在输入框对用户的输入做一些限制 eg: <el-input @input="numValid(phone)" v-model="phone" autocomplete="off"></el-input> numValid(val){ //只能输入数字 this.phone = val.replace(/[^0-9]/g,'') } ...原创 2021-04-13 22:07:30 · 1465 阅读 · 0 评论 -
针对报错Cannot read property ‘xxxx‘ of undefined at <anonymous>
Uncaught TypeError: Cannot read property ‘city’ of undefined at :1:28 例: let person = { province:'beijing', num:18, } console.log(person.address.city) 是因为没有进行判断,像上面的例子里面的address肯定是undefined,你想要去读city,city在undefined里肯定是不存在的 解决方法 es2020新出的语法糖 非常的方便 consol原创 2020-12-29 17:36:43 · 1719 阅读 · 0 评论