解決Vue項(xiàng)目中tff報(bào)錯(cuò)的問題
在webpack.config.js中的模塊配置中加如下的配置規(guī)則:
{test: /.(woff2?|eot|ttf|otf)(?.*)?$/, use: 'url-loader'}
const path = require(’path’);const htmlWebpackplugin = require(’html-webpack-plugin’);const VueLoaderPlugin = require(’vue-loader/lib/plugin’); module.exports = { entry: path.join(__dirname,’./src/main.js’), output: { path: path.join(__dirname, ’./dist’), filename: ’bundle.js’ }, plugins: [ new htmlWebpackplugin({ //創(chuàng)建一個(gè)在內(nèi)存中生成的html頁面的插件 template: path.join(__dirname, ’./src/index.html’), filename: ’index.html’ }), new VueLoaderPlugin() ], module: { //這個(gè)節(jié)點(diǎn)用于配置所有的第三方模塊加載器 rules: [ {test: /.css$/, use:[’style-loader’,’css-loader’]},//配置處理.css文件的第三方處理規(guī)則 {test: /.less$/, use: ['style-loader',’css-loader’,’less-loader’]}, {test: /.scss$/, use: ['style-loader',’css-loader’,’sass-loader’]}, {test: /.(jpg|png|gif|bmp|jpeg)$/, use: 'url-loader?limit=8000'}, {test: /.(woff2?|eot|ttf|otf)(?.*)?$/, use: 'url-loader'}, {test:/.js$/, use:’babel-loader’,exclude:/node_modules/}, {test: /.vue$/, use: ’vue-loader’} ] }};
補(bǔ)充知識(shí):vue項(xiàng)目引入字體.ttf的操作步驟
1、下載所需要的字體,.ttf格式本文以(FZCYJ.ttf 為例)
2、在src下新建common文件,文件夾中包含以下文件
3、打開font.css
@font-face { font-family: ’FZCYJ’; //重命名字體名 src: url(’FZCYJ.ttf’); //引入字體 font-weight: normal; font-style: normal; }
4、配置webpack.base.conf.js 文件
5、App.vue引入字體
6、可在body中設(shè)置字體
body{ font-family: FZCYJ;}
以上這篇解決Vue項(xiàng)目中tff報(bào)錯(cuò)的問題就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. ASP常用日期格式化函數(shù) FormatDate()2. Python數(shù)據(jù)相關(guān)系數(shù)矩陣和熱力圖輕松實(shí)現(xiàn)教程3. 什么是Python變量作用域4. 開發(fā)效率翻倍的Web API使用技巧5. bootstrap select2 動(dòng)態(tài)從后臺(tái)Ajax動(dòng)態(tài)獲取數(shù)據(jù)的代碼6. CSS3中Transition屬性詳解以及示例分享7. js select支持手動(dòng)輸入功能實(shí)現(xiàn)代碼8. Java xml數(shù)據(jù)格式返回實(shí)現(xiàn)操作9. vue使用moment如何將時(shí)間戳轉(zhuǎn)為標(biāo)準(zhǔn)日期時(shí)間格式10. python 如何在 Matplotlib 中繪制垂直線
