大家好,我是新手Vue JS,我试图在单文件模板上使用混入到我的过滤器中,但我遇到了一些困难
我收到的错误
Unknown custom element: <side-bar-one> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
组件.js
Vue.component('sideBarOne', require('./component/sidebars/sideBarOne.vue'));
侧边栏一.vue
import { default as config } from '../../../config';
import { filters as filter } from '../../../mixins/filters';
export default {
mixins: [
filter,
],
mounted: function() {
}
}
筛选器.js
import { default as config } from '../config';
module.exports = {
filters: {
useLGLogo( str ) {
if( str ) {
return config.LG_LOGO + str.replace(/\s+/g, '-').toUpperCase() + '.png';
}
},
useMDLogo( str ) {
if( str ) {
return config.MD_LOGO + str.replace(/\s+/g, '-').toUpperCase() + '.png';
}
},
useSMLogo( str ) {
if( str ) {
return config.SM_LOGO + str.replace(/\s+/g, '-').toUpperCase() + '.png';
}
},
}
};
import filters from
,而不是import { default as filters }
。 - Eric Guan