Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to cancel the strict mode in vue

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the knowledge of "how to cancel the strict mode in vue". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

How to cancel the strict mode

If you encounter the following errors while working on a project:

Solution.

There will be a separate eslintrc.js file in the 1.vue cli4 project, and this js file contains the configuration items of the code specification. You can try to comment out'@ vue/standard', to turn off the Eslint syntax specification.

/ /'@ vue/standard'

Restart the project npm run serve.

two。 Find vue.config.js. If not, you can create a new one yourself and configure the following

LintOnSave: false,devServer: {overlay: {warning: false,errors: false}}

Restart the project npm run serve.

After this configuration is added, it can be said that eslint is completely closed and there will be no more errors.

3. There is another js configuration file setting.js in the project, which is lintOnSave: true

So the configuration in vue.config.js is invalid

4. Find setting.js and change it to lintOnSave: false

So you can also search the configuration property lintOnSave globally, find out where this sentence is, change it to false and turn off eslint detection completely. If you can't find lintOnSave, you can refer to step 2.

Cancel strict mode, remove format warning

We often encounter a lot of warnings when writing vue code, because we always write yes when we create the code, or hit enter, that is, the strict mode of eslint is installed by default.

When running tests, there will be a lot of warnings and errors, the page display will become very troublesome, if you get used to it, you can develop good code habits.

So how to remove these warnings, turn off strict mode, as long as in the webpack.base.conf.js under the build folder. (config.dev.useEslint? [createLintingRule ()]: []), comment out, and then restart the project.

Note: after commenting, you must remember to run a project again, otherwise you will still follow the original rules.

This is the end of the content of "how to cancel the strict Mode in vue". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report