mazipan / vue2-simplert

⚠️ Vue 2 Simple Alert Component (SweetAlert Inspired)
https://vue2-simplert.gitbook.io/docs/
MIT License
214 stars 31 forks source link

How to use Simplert with CDN #57

Open Laranjeiras opened 5 years ago

Laranjeiras commented 5 years ago

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"

paulodiogo commented 5 years ago

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

amchconsult commented 4 years ago

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

Thank you