euvl/vue-js-toggle-button

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

Closed this issue · 3 comments

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
import ToggleButton from 'vue-js-toggle-button'
Vue.use(ToggleButton)

It already tried, but question was same.

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.