2

I'm failry new to VueJs so keep that in mind.

I've got single template component like this

 <template>
    <div class="testing-container">
        <button v-on:click="toggleContainer" class="btn btn-success btn-sm show-testing-container">Testing <i v-if="!show" class="fa fa-chevron-up"></i><i v-if="show" class="fa fa-chevron-down"></i></button>
        <div v-if="show" class="testing-frame">
            <vue-tabs active-tab-color="#e74c3c"
                      active-text-color="white"
                      type="pills"
                      :start-index="1"
                      direction="vertical"
            >
                <v-tab title="First tab" icon="ti-user">
                    First Tab
                </v-tab>

                <v-tab title="Second tab" icon="ti-settings">
                    Second tab content
                </v-tab>

                <v-tab title="Third tab" icon="ti-check">
                    Third tab content
                </v-tab>
            </vue-tabs>
        </div>
    </div>
</template>
<script>
    export default {
        data() {
            return {
                show: false,
            };
        },
        created() {
        },
        methods: {
            toggleContainer() {
                if(this.show){
                    this.show = false;
                }else{
                    this.show = true;
                }
            },
        }
    }
</script>

I'm trying to load in another componenet called vue-tabs but I keep getting

[Vue warn]: Failed to mount component: template or render function not defined. found in ---> <VueTabs>

This is my constructor stuff:

/**
 * Import Vue Tabs
 */
import VueTabs from "vue-nav-tabs"
/**
 * Vue Nav Tabs
 */
Vue.component('vue-tabs', VueTabs)
/**
 * Units Testing Component
 */
Vue.component('unit-testing',
    require('./components/testing/UnitTesting.vue')
);

const app = new Vue({
    el: '#app',
});

Gulp Watch is not throwing any Not found Errors so I'm really confused as to what is going on here. I appreciate for the help in advance.

5
  • What is your build setup? Are you flowing through something like vue-loader or gulp-vueify? The vue file is a convenience format. It has to be transformed before it can be imported. Commented Feb 6, 2018 at 18:42
  • I'm not sure if this is the same thing but I'm using gulp to build it, and from what I undesrtand it uses laravel elixir to webpack app.js Commented Feb 6, 2018 at 18:45
  • 2
    Have you tried doing import { VueTabs } from "vue-nav-tabs"? Commented Feb 6, 2018 at 18:45
  • 1
    @sklingler93 , this did the job, can you possibly tell me what is the difference, considering other examples don't have the brackets? Commented Feb 6, 2018 at 18:48
  • The examples do use the brackets for local registration: vuejs.creative-tim.com/vue-tabs/#/?id=component-registration Commented Feb 6, 2018 at 18:52

1 Answer 1

11

Using es6 imports:

import VueTabs from "vue-nav-tabs"

will import the default export from the module as VueTabs (which is a vue plugin in this case, not the component you are trying to use).

While:

import { VueTabs } from "vue-nav-tabs"

will import the VueTabs export from the module.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.