vuejs dialog not working from ts file

Jak
Jak
Member
858 Points
132 Posts

I'm using 'vuejs-dialog' to open confirmation box. And I'm following https://www.npmjs.com/package/vuejs-dialog

I'm try to use following code in vuejs i.e on ts file:

// Trigger an Alert dialog
this.$dialog.alert('Request completed!')
    .then(function (dialog) {
        console.log('Closed')
    })
    
// Trigger a confirmation dialog
this.$dialog.confirm('Please confirm to continue')
    .then(function (dialog) {
        console.log('Clicked on proceed')
    })
    .catch(function () {
        console.log('Clicked on cancel')
    });

But it's not working for me and throwing error: "$dialog not available"

Although, It's working fine in html page:

// While looping through users
<button v-for="user in users"
        v-confirm="{
            loader: true,
            ok: dialog => makeAdmin(dialog, user),
            cancel: doNothing,
            message: 'User will be given admin privileges. Make user an Admin?'}"
>
Make Admin
</button>

I don't know what is happening.

 

Views: 9642
Total Answered: 0
Total Marked As Answer: 0
Posted On: 21-Sep-2018 02:26

Share:   fb twitter linkedin
Answers
 Log In to Chat