<i id='AyVPt'><tr id='AyVPt'><dt id='AyVPt'><q id='AyVPt'><span id='AyVPt'><b id='AyVPt'><form id='AyVPt'><ins id='AyVPt'></ins><ul id='AyVPt'></ul><sub id='AyVPt'></sub></form><legend id='AyVPt'></legend><bdo id='AyVPt'><pre id='AyVPt'><center id='AyVPt'></center></pre></bdo></b><th id='AyVPt'></th></span></q></dt></tr></i><div id='AyVPt'><tfoot id='AyVPt'></tfoot><dl id='AyVPt'><fieldset id='AyVPt'></fieldset></dl></div>

<small id='AyVPt'></small><noframes id='AyVPt'>

    <tfoot id='AyVPt'></tfoot>

      • <bdo id='AyVPt'></bdo><ul id='AyVPt'></ul>
    1. <legend id='AyVPt'><style id='AyVPt'><dir id='AyVPt'><q id='AyVPt'></q></dir></style></legend>
    2. Vue Js如何在单个文件模板中使用mixins?

      时间:2023-09-05

            <small id='CJ9wN'></small><noframes id='CJ9wN'>

            • <bdo id='CJ9wN'></bdo><ul id='CJ9wN'></ul>

              <legend id='CJ9wN'><style id='CJ9wN'><dir id='CJ9wN'><q id='CJ9wN'></q></dir></style></legend>
                <tbody id='CJ9wN'></tbody>
              <i id='CJ9wN'><tr id='CJ9wN'><dt id='CJ9wN'><q id='CJ9wN'><span id='CJ9wN'><b id='CJ9wN'><form id='CJ9wN'><ins id='CJ9wN'></ins><ul id='CJ9wN'></ul><sub id='CJ9wN'></sub></form><legend id='CJ9wN'></legend><bdo id='CJ9wN'><pre id='CJ9wN'><center id='CJ9wN'></center></pre></bdo></b><th id='CJ9wN'></th></span></q></dt></tr></i><div id='CJ9wN'><tfoot id='CJ9wN'></tfoot><dl id='CJ9wN'><fieldset id='CJ9wN'></fieldset></dl></div>
              • <tfoot id='CJ9wN'></tfoot>
                本文介绍了Vue Js如何在单个文件模板中使用mixins?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                大家好,我是 Vue JS 的新手,我正在尝试使用单个文件模板在我的过滤器上使用 mixins,但我遇到了一些困难

                Hi everyone im new to Vue JS and im trying to use mixins on my filters using single file template and I'm having some hard time

                我遇到的错误

                Unknown custom element: <side-bar-one> - did you register the component correctly? For recursive components, make sure to provide the "name" option. 
                

                component.js

                component.js

                Vue.component('sideBarOne', require('./component/sidebars/sideBarOne.vue'));
                

                sideBarOne.vue

                sideBarOne.vue

                import { default as config } from '../../../config';
                import { filters as filter } from '../../../mixins/filters';
                
                export default {
                        mixins: [
                            filter,
                        ],
                        mounted: function() {
                        }
                 }
                

                filters.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';
                            }
                        },
                    }
                };
                

                推荐答案

                我已经对我的文件进行了一些更改并使其正常工作

                I've made some changes on my files and made it working

                filters.js

                    import { default as config } from '../config';
                    var filters = {
                        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';
                                }
                            },
                        }
                    };
                
                export default filters;
                

                sideBarOne.vue

                sideBarOne.vue

                import { default as filters } from '../../../mixins/filters';
                    export default {
                        mixins: [
                            filters,
                        ],
                        mounted: function() {
                        }
                    }
                

                这篇关于Vue Js如何在单个文件模板中使用mixins?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:条件渲染 React 组件并保持 DRY 的最佳方法 下一篇:使用 Sass 根据背景颜色更改颜色

                相关文章

                <legend id='gTZzm'><style id='gTZzm'><dir id='gTZzm'><q id='gTZzm'></q></dir></style></legend>

              • <tfoot id='gTZzm'></tfoot>
              • <i id='gTZzm'><tr id='gTZzm'><dt id='gTZzm'><q id='gTZzm'><span id='gTZzm'><b id='gTZzm'><form id='gTZzm'><ins id='gTZzm'></ins><ul id='gTZzm'></ul><sub id='gTZzm'></sub></form><legend id='gTZzm'></legend><bdo id='gTZzm'><pre id='gTZzm'><center id='gTZzm'></center></pre></bdo></b><th id='gTZzm'></th></span></q></dt></tr></i><div id='gTZzm'><tfoot id='gTZzm'></tfoot><dl id='gTZzm'><fieldset id='gTZzm'></fieldset></dl></div>
                  1. <small id='gTZzm'></small><noframes id='gTZzm'>

                      <bdo id='gTZzm'></bdo><ul id='gTZzm'></ul>