mazipan / vue2-simplert

⚠️ Vue 2 Simple Alert Component (SweetAlert Inspired)

Home Page:https://vue2-simplert.gitbook.io/docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use Simplert with CDN

Laranjeiras opened this issue · comments

I I am trying to use by CDN, but i receive erro.

<script src="https://unpkg.com/vue2-simplert@0.5.1/dist/simplert.bundle.js"></script>

<script>
Vue.use(Simplert);
new Vue({
            el: '#app',  
            mounted() {
                let obj = {
                    title: 'Alert Title',
                    message: 'Alert Message',
                    type: 'info'
                }
                this.$refs.simplert.openSimplert(obj)
            }
});  
</script>

Error message in console

[Vue warn]: Error in mounted hook: "TypeError: Cannot read property 'openSimplert' of undefined"

You need to add <simplert :useRadius="false" :useIcon="false" ref="simplert"></simplert> inside your app.

Check this: https://codepen.io/paulodiogo/pen/VOPjMN?editors=1010

why is it not working with CDN on 1.1.0?
can you add global? example please.

Thank you