How to use css in vuejs: 1. Directly apply handwritten styles, code such as ""; 2. Apply external css file writing, syntax such as "@import './index.css'".
The operating environment of this article: Windows 7 system, Vue version 2.9.6, DELL G3 computer.
How to use css in Vue.js?
Use sass and less to write css styles in vue-cli. The steps are very simple because vue-cli has already configured sass and less. , we need to use sass or less to directly download the two modules, and then webpack will automatically use the appropriate loader to process them based on the lang attribute. Let’s take a look at how each css should be used
1. Just apply handwritten styles and use css rules. .
2. How to apply external css files
1. Install the Sass module
2. Use it in the style part of the component Inline writing
3. Writing method of citing sass external files.
1. Install the Less module
2. Use inline writing in the style part of the component
##3. How to quote less external files.
Related recommendations: "
vue.js Tutorial"
The above is the detailed content of How to use css in vuejs. For more information, please follow other related articles on the PHP Chinese website!