euvl / vue-js-toggle-button

:fish_cake: Vue.js 2 toggle / switch button - simple, pretty, customizable
http://vue-js-toggle-button.yev.io/
MIT License
934 stars 133 forks source link

[Vue warn]: Failed to mount component: template or render function not defined. #89

Closed TechnicalSuwako closed 5 years ago

TechnicalSuwako commented 6 years ago

I'm receiving this problem.

[Vue warn]: Failed to mount component: template or render function not defined.

In template:

発行済の証明書を
<toggle-button
  :value="false"
  :sync="true"
  :color="{
    checked: '#1d99f3',
    unchecked: '#cfbaba'
  }"
  :labels="{
    checked: '表示する',
    unchecked: '非表示する'
  }"
/>

In script:

import ToggleButton from 'vue-js-toggle-button';

export default {
  components: {
    ToggleButton
  },
...

How can it be cured?

euvl commented 6 years ago
import ToggleButton from 'vue-js-toggle-button'
Vue.use(ToggleButton)
TechnicalSuwako commented 6 years ago

It already tried, but question was same.

laurengranada commented 6 years ago

If you have a main.js file or the file that has all your required npm packages, you need to add the "import ToggleButton from 'vue-js-toggle-button'" there and then add the "Vue.use(ToggleButton)" line in that file as well. Then - in your component file where you want to use the Toggle Button, you simply just need to add the " etc.." in your template code.