我有一个类星体项目,其中材质图标显示为文本而不是图标。我确实使用npm安装了这些软件包。尽管如此,它还是不起作用。
下面是我的app.js文件
require('./bootstrap');
window.Vue = require('vue');
require('quasar/dist/quasar.css');
require('quasar/dist/quasar.min.css');
import Quasar from 'quasar';
import 'vuetify/dist/vuetify.min.css';
import Vuetify from 'vuetify';
import Vue from 'vue';
import Plugin from '@quasar/quasar-ui-qiconpicker';
import '@quasar/quasar-ui-qiconpicker/dist/index.css';
import '@quasar/quasar-ui-qiconpicker/dist/icon-set/eva-icons.umd.js';
import '@quasar/quasar-ui-qiconpicker/dist/icon-set/fontawesome-v5.umd.js';
import '@quasar/quasar-ui-qiconpicker/dist/icon-set/ionicons-v4.umd.js';
import '@quasar/quasar-ui-qiconpicker/dist/icon-set/material-icons-outlined.umd.js';
import '@quasar/quasar-ui-qiconpicker/dist/icon-set/material-icons-round.umd.js';
import '@quasar/quasar-ui-qiconpicker/dist/icon-set/material-icons-sharp.umd.js';
import '@quasar/quasar-ui-qiconpicker/dist/icon-set/material-icons.umd.js';
import '@quasar/quasar-ui-qiconpicker/dist/icon-set/mdi-v4.umd.js';
import '@quasar/quasar-ui-qiconpicker/dist/icon-set/themify.umd.js';
Vue.use(Plugin)
Vue.use(Quasar);
Vue.use(Vuetify);
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
Vue.component('example-component', require('./components/ExampleComponent.vue').default);
Vue.component('example-component1', require('./components/Com.vue').default);
Vue.component('example-component2', require('./components/Comp.vue').default);
let app = new Vue({
el: '#app',
icons: {
iconfont: 'mdi', // default - only for display purposes
},
});
在您的quasar.conf.js中,您必须指定要使用的图标集——在该文件中列出了几个选项。然后,确保在指定图标名称时,它们与材料设计网站上的图标名称相匹配。我还看到,当你只需要Material时,你正在导入所有的图标集——这可能是浪费内存。
您是否在文档中添加了材质图标字体?https://fonts.googleapis.com/icon?family=Material+图标&yav=40bde127