前端常用小tips:
提示:这里可以添加要学的内容
例如:
- 只能数字且首字母不能为0:
this.number = value.replace(/\D/g, '').replace(/^0{1,}/g, '');
- 置空:
this.$options.data().form;(重置vue组件中的data数据);
- 赋值:
this.$set(this.search.model, key, value);
- 执行子组件里的函数:
this.$refs['detail'].opendetail();
// opendetail()是子组件里的函数 - 重置表单数据:
this.$refs.form?.resetFields();
方法二: Object.assign(this.$data.form, this.$options.data().form);
Object.keys(this.payPlan).forEach((key) => {
this.payPlan[key] = '';
});
this.$refs['payPlan'].resetFields();
this.payPlan = this.$options.data().payPlan;
6.查找是否有: ['CASH', 'UnionPay'].includes(this.payPlan.paymentChannel)