Tag Archives: Console error

[Solved] Uncaught SyntaxError: Cannot use import statement outside a module

1. Error description

Uncaught SyntaxError: Cannot use import statement outside a module

2. Error reason

  Defines a JavaScript file, declares several variables, and uses modularity to export the variables

Let name = “Zhang Hua”
let age = 23
let sex = “female”

Export {name, age, sex}
then, import directly in the page file; Open the browser to access the page, and an error appears on the console

3. Solution

  Need to add the attribute type="module" to the script tag

The page console error [Vue warn]: Invalid prop: custom validator check failed for prop “status“

Invalid prop: custom validator check failed for prop “status” encountered during project debugging##

First of all, I was confused. I went to the prop and didn’t have status. I really couldn’t figure out what was going on. Through the global search of status, I realized that it was the problem of style components. Because of the company’s confidentiality, I really wanted to simulate the code

<el-progress  :percentage="stepPercentage(item.step)"  status="error"></el-progress>

The status in this code is the key to error reporting. The reason is that I added an unknown attribute error of status, which makes it unrecognizable

be careful

1. The value of status can only be one of “success/exception/warning”. Other values will give the above warning. If you have to judge according to the conditions and need to give the default color, you can assign null [null, no quotation marks] to the value

<el-progress  :percentage="stepPercentage(item.step)" :status="item.step == 4 ?'success' :null"></el-progress>

2. You can’t have spaces in the parameters following status. You need to correct the format