Home > Web Front-end > Vue.js > body text

How to solve the error problem when vue introduces font css

藏色散人
Release: 2020-11-30 10:38:29
Original
3225 people have browsed it

The solution to the error when Vue introduces font css: 1. Import the style file of the font where it is used; 2. Change "font.styl" to "font.css"; 3. Change the file that stores the font The font folder is moved to the static folder at the same level as src.

How to solve the error problem when vue introduces font css

The operating environment of this tutorial: windows7 system, vue2 version, this method is suitable for all brands of computers.

Recommended: "vue Tutorial"

Solution to the error report when using @font-size to introduce font icons in Vue2.x

Project platform built using vue-cli

Using css style written by stylus

There is css-loader dependency package x

The following picture is webpack.base.conf.js Regarding the configuration of font files

How to solve the error problem when vue introduces font css
Some people have duplicate font file configurations, just delete one item

Problems that arise: Problems with introducing font icons

1. Error reporting

How to solve the error problem when vue introduces font css

Change the relative path introduced by the font to an absolute path
Relative path
How to solve the error problem when vue introduces font css
Absolute path
How to solve the error problem when vue introduces font css

2. No error is reported, but the font icon that appears is a small box

There is a warning message:

How to solve the error problem when vue introduces font css

Little Square:

How to solve the error problem when vue introduces font css

The error reported is due to redirection problem

The reason for the above problem

  • ① The style file of the font is not introduced where it is used
  • ② The file with the suffix .styl is used
  • ③ Move the font folder to the static folder and use the absolute path to access it , at this time you can use the .styl file

①The solution isIntroduce the font style file where it is used (if it is imported globally, it needs to be imported from app.vue)

@import '文件路径'
Copy after login
Copy after login

②The solution is to change font.styl to font.css (due to the stylus preprocessor)
How to solve the error problem when vue introduces font css

and then need it again Import where used

@import '文件路径'
Copy after login
Copy after login

③ Move the font folder that stores the fonts to the static folder on the same level as src, and then use the absolute path to access the icon.styl file
How to solve the error problem when vue introduces font css

For more programming-related knowledge, please visit: Programming Learning! !

The above is the detailed content of How to solve the error problem when vue introduces font css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
vue
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!