[Vuejs]-Await in vue3 function for button click

0๐Ÿ‘

        OnButtonPress() {
        return new Promise((resolve) => {
            Vue.nextTick(function () {
                const confirm = document.getElementById('saveftobutton')
                confirm.addEventListener('click', function() {
                    resolve(true);
                });
                const deny = document.getElementById('cancelftobutton')
                deny.addEventListener('click', function() {
                    resolve(false);
                });
            });
        });
    },

Had to put the return before Vue.nextTick.

Leave a comment