Tag Archives: vue

Arrow function should not return assignment no-return-assign

Arrow function should not return assignment no return assignment.

This paper describes the problems encountered in learning p221 of the latest Vue and vuejs in 2019, from introduction to mastery. Because the checking code of eslint is referenced, the checking error is reported. There is no problem with the code, it is the problem of eslint checking.
Solutions: 1. Remove eslint
2. Modify the code to conform to eslint
original code

   if (this.isSelectAll) {
        this.cartList.forEach(item => item.checked = false)
      } else {
        this.cartList.forEach(item => item.checked = true)
      }

Changed code

   if (this.isSelectAll) {
        this.cartList.forEach(item => { item.checked = false })
      } else {
        this.cartList.forEach(item => { item.checked = true })
      }

After learning the arrow function, we can know that the {} added can be omitted, but the rule of eslint requires this.

The influence of the loading order of props, data and computed in Vue

The influence of the loading order of props, data and computed in Vue

1. Computed and watch can only be used as change monitor, never initialization!!!

2. Because the loading order is props – & gt; methods – & gt; data – & gt; computed – & gt; watch

3. All init methods must directly call the database or this$ store.getters Read memory instead of computing it

Module build failed: TypeError [ERR_INVALID_ARG_TYPE]: The “path“ argument must be of type string.

The following error was reported for the VUE project

Module build failed: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at validateString (internal/validators.js:121:11)
    at Object.join (path.js:375:7)
    at getSassOptions (D:\VueProj\test\node_modules\sass-loader\dist\utils.js:160:37)
    at Object.loader (D:\VueProj\test\node_modules\sass-loader\dist\index.js:36:49)

sass-loader version is too high cause, reinstall the lower version of sass-loader.

npm uninstall sass-loader
npm install --save-dev [email protected]

After introducing sass into Vue project, start to report error typeerror [err]_ INVALID_ ARG_ Type]: the “path” argument must be of type string

 
Vue file using lang=” SCSS “,
The solution: be sure to install sass-loader and node-sass
TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string.
 
Json: “node-sass”: “^4.11.1”, “sass-loader”: “^7.3.0
Delete the node_modules folder and re-execute NPM install. Perfect solution

Expected indentation of 6 spaces but found 10

Expected indentation of 6 Spaces but found
10 The code is automatically formatted according to IDEA’s reformat
de, and the result is that the error is reported more and more. When Vue projects are initialized, ESLint is installed by default (ESLint is a syntax-rule and style-checking tool that can be used to ensure that syntax-correct, style-consistent code is written).

The solution here is to turn ESLint off, as follows.
Open the project’s…/build/webpack. Base. Conf. Js file, find the module properties, comment out the following this line of code.

Problems that Vue project manager can’t open

Vue UI must version to 3.0.0 or above to use
if you install version below 3.0.0, so the command line (CMD) under arbitrary path input (uninstall current version) : the vue -v
see version 2.9.6 so sure to uninstall:
enter the command: after first CMD where vue
after entering the specified directory delete all of the vue related files,
with a vue delete all

Then type: CNPM install – g @ vue/cli

then find see the latest version of the

in the specified file open visual tools input vue UI

jump out successfully