vue踩过的坑

1、注释时“//” 后一定要有空格;
否则会报:Expected exception block, space or tab after ‘//’ in comment spaced-comment
2、冒号后面空格,逗号后面空格;
3、注意单引号的使用:
Strings must use single quote,把引号改为单引号就可以了
4、将单引号改为TAB键上面的符号
Unexpected template string expression
例:
修改前

directUrl('/lot/eqpSpotCheck/${this.qcInfo.lotId}');

修改后:

 directUrl(`/lot/eqpSpotCheck/${this.qcInfo.lotId}`);

5、Component template should contain exactly one root element. If you are using
注:只需在上层再加个div标签即可或者将新加标签放在外层标签内

<div class="content">
	<MaterialInOutBasicInfo :lotInfo="lotInfo"/>
</div>

6、 在methods中赋值时如果直接 this.date2 = param[3];
报Use array destructuring prefer-destructuring
修改前:

setChooseValue2(param) {
	this.date2 = param[3];
}

修改后:

setChooseValue2(param) {
	const theDate = param[3];
	this.date2 = theDate;
}

7、Unexpected string concatenation of literals
日期拼接不能使用+号
修改前:

let time = year + '-' + month + '-' + day + ' ' + '0' + ':' + '0';

修改后:

// 不用0拼接
let time = year + '-' + month + '-' + day + ' ' + hour + ':' + minute;
// 若非要带0换个方式
let time = `${year}-${month}-${day} ${0}:${0}`;
// 同样
let time = `${year}-${month}-${day} ${hour}:${minute}`;

8、Unknown custom element: - did you register the component correctly?
如果发现有引人nutui,但是还是报标签问题,那么需要在common中查看对应的js,看是否有引人DatePicker,没有则需引人,具体引人方式参考文件中其他组件引人方式。
9、移动端nut-datepicker时间选择器定位异常
如图:
在这里插入图片描述

查看nut-datepicker发现,引用的是picker.scss里的样式
在这里插入图片描述
经过多次查找,发现是样式定位异常导致,只需要在全局样式文件重新定义即可:

<style>
    .nut-picker-list .nut-picker-content, .nut-picker-list .nut-picker-roller {
        position: relative;
    }
</style>

10、Use object destructuring prefer-destructuring
定义的变量名重复:

const id = this.qcInfo.id;

更改变量名即可。

  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值