3 months ago by drax7

I would like to use this library for alerts in my app. I have installed it and created a component like this:

<script>
import Simplert from 'vue2-simplert'

export default {
  data () {
    return {
      obj: {
        title: 'Alert Title',
        message: 'Alert Message',
        type: 'info',
        useConfirmBtn: true,
        customConfirmBtnText: 'OK'
      },
    }
  },
  methods: {
    openSimplert () {
      this.$refs.simplert.openSimplert(this.obj)
    },
  }
}
</script>

I am registering the component in my app.js like this:

window.Vue = require('vue/dist/vue.common');
Vue.component('alert', require('./components/Alert.vue'));

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

And then trying to use it in my template:

<alert :useRadius="true"
       :useIcon="true"
       ref="simplert">
</alert>

I can see the component in the vue debug tools, but no html is being created, I can only see this:

<!--function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }-->

Ant I get the error in the console:

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

found in

---> <Alert> <Root>

What is wrong, how can I fix this?

Sign in or create an account to reply to this topic.