JAVAScript/Answer Detail

vuejs dialog not working from ts file

Jak
Jak
Member
350 Points
150 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.

 

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

Share:   fb twitter linkedin
Answers
banner

Blog

Active User (13)

 Log In to Chat