vue introduction of font files

1. download the font file .ttf file and the introduction of:
Here Insert Picture Description
2. font.css file, the path to the downloaded font file introduction:

@font-face {  
    font-family: 'PMZD';  
    src: url('PMZD.ttf'); 
    font-weight: normal;  
    font-style: normal;  
}

3. font.css introduced in the style you want to use it:

@import "../less/font/font.css";

4. webpack configuration file to add the rule to resolve .ttf file:


module: {
    rules: [
        {
            test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
            loader: 'url-loader',
            options: {
                limit: 10000,
                name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
            }
        }
    ]
}

Published 99 original articles · won praise 91 · views 20000 +

Guess you like

Origin blog.csdn.net/HuangsTing/article/details/104047680