Vue.js 不加载组件主题 Vue.use
Vue.js load component theme without Vue.use
我正在使用 Cool-Select,它需要以下代码来加载其主题:
import VueSelect from 'vue-cool-select'
Vue.use(VueSelect, {
theme:'material-design'
})
问题是我不想为了只使用一个主题而导入整个 vue 代码。此外,组件在没有主题导入的情况下也能正常工作;只是缺少 css.
是否可以像这样在 components
部分导入本地主题?
import { CoolSelect } from 'vue-cool-select'
components:{
CoolSelect,
// import theme here
},
VueSelect
是一个插件,即它有 install
method that will be called when provided to Vue.use
. This doesn't affect the application except that it loads styles that are specific to this component.
由于样式没有从包中导出并且仅在插件安装时加载,因此这是 CoolSelect
组件可以在不分叉包的情况下加载其样式的唯一方法:
Vue.use(VueSelect, {
theme:'material-design'
})
我正在使用 Cool-Select,它需要以下代码来加载其主题:
import VueSelect from 'vue-cool-select'
Vue.use(VueSelect, {
theme:'material-design'
})
问题是我不想为了只使用一个主题而导入整个 vue 代码。此外,组件在没有主题导入的情况下也能正常工作;只是缺少 css.
是否可以像这样在 components
部分导入本地主题?
import { CoolSelect } from 'vue-cool-select'
components:{
CoolSelect,
// import theme here
},
VueSelect
是一个插件,即它有 install
method that will be called when provided to Vue.use
. This doesn't affect the application except that it loads styles that are specific to this component.
由于样式没有从包中导出并且仅在插件安装时加载,因此这是 CoolSelect
组件可以在不分叉包的情况下加载其样式的唯一方法:
Vue.use(VueSelect, {
theme:'material-design'
})