Buefy:如何在单独注册组件时设置图标包
Buefy: How to set icon-pack while registering components individually
在我的 Vue.js 项目的 main.ts 中,我注册了如下字体超棒的图标(根据 Buefy documentation):
library.add(faArrowUp, faArrowLeft, faArrowRight, faExclamationCircle, faExclamationTriangle, faCalendar);
Vue.component('font-awesome-icon', FontAwesomeIcon);
Vue.use(Vue, {
defaultIconPack: 'fas',
defaultIconComponent: 'font-awesome-icon'
});
这按预期工作并使 Buefy 组件使用相关图标。
现在,为了减少我的应用程序的包大小,我更改为仅注册我的应用程序使用的组件(根据 documentation):
Vue.use(Loading);
Vue.use(Skeleton);
Vue.use(Table, {
defaultIconPack: 'fas',
defaultIconComponent: 'font-awesome-icon'
});
// more components...
我现在不知道如何正确注册图标包。当我将相关属性设置为上述 Table 组件的选项时,该组件未使用图标。
有什么想法吗?
好的,我found it:
Vue.use(Loading);
Vue.use(Skeleton);
Vue.use(Table);
ConfigProgrammatic.setOptions({
defaultIconPack: 'fas',
defaultIconComponent: 'font-awesome-icon'
});
在我的 Vue.js 项目的 main.ts 中,我注册了如下字体超棒的图标(根据 Buefy documentation):
library.add(faArrowUp, faArrowLeft, faArrowRight, faExclamationCircle, faExclamationTriangle, faCalendar);
Vue.component('font-awesome-icon', FontAwesomeIcon);
Vue.use(Vue, {
defaultIconPack: 'fas',
defaultIconComponent: 'font-awesome-icon'
});
这按预期工作并使 Buefy 组件使用相关图标。
现在,为了减少我的应用程序的包大小,我更改为仅注册我的应用程序使用的组件(根据 documentation):
Vue.use(Loading);
Vue.use(Skeleton);
Vue.use(Table, {
defaultIconPack: 'fas',
defaultIconComponent: 'font-awesome-icon'
});
// more components...
我现在不知道如何正确注册图标包。当我将相关属性设置为上述 Table 组件的选项时,该组件未使用图标。
有什么想法吗?
好的,我found it:
Vue.use(Loading);
Vue.use(Skeleton);
Vue.use(Table);
ConfigProgrammatic.setOptions({
defaultIconPack: 'fas',
defaultIconComponent: 'font-awesome-icon'
});