天天看點

vue cli3打包報錯

報錯1:

272:1  error  Irregular whitespace not allowed  no-irregular-whitespace

           

報錯是沒有用規範的寫法,有多餘的空格

報錯2:

error  'scope' is defined but never used  vue/no-unused-vars

           

報錯是element-ui的scope,定義了但沒用過

報錯1解決:

由于我不喜歡vscode的自動格式化效果,一屏放不下幾行代碼,是以我不打算格式化我的代碼來解決這個問題,最後是屏蔽樂eslint代碼的格式報錯:

1. 進入node_modules\eslint-config-standard

2. 打開eslintrc.json

3. 在rules裡将 “no-irregular-whitespace”: “error” 改為"no-irregular-whitespace": “off”

報錯2解決

slot-scope是elment-ui自定義的指令,有時候需要自定義但是并不需要使用scope這個參數,在代碼中會報紅,但是項目運作不影響,打包報了錯。

原寫法:

<template slot="header" slot-scope="scope">
	<div class="tec_forcast_title">
	...
	</div>
<template>
           

解決報錯的寫法:

<template slot="header" slot-scope="{}">
	<div class="tec_forcast_title">
	...
	</div>
<template>
           

繼續閱讀