Vue how to proceed next method on dialog onOK()
-
So, I have this float button which a dialog which notify user to login, upon dialog appear, there are two option -cancel and ok. And I had create login component then I import in this code (i set false to hide). So my plan whenever press ok which go to login component . Since this code made by someone and im still newbie to continue it. Hopefully someone can help code it.
<template> <q-page-sticky position="bottom-right" :offset="[18, 18]"> <q-btn fab icon="add" color="primary" @click="verifyUser"/> </q-page-sticky> <q-dialog v-model="state.formDialog" persistent> <q-card> <NewWord @close="state.formDialog=false" /> </q-card> </q-dialog> <LoginComponents v-model='value'/> </template> <script> import { defineComponent, reactive } from 'vue' import { globalState } from '../util' import NewWord from './../pages/NewWord' import { Dialog } from 'quasar' import LoginComponents from 'components/LoginComponents' export default defineComponent({ components: { NewWord, LoginComponents }, setup () { const state = reactive({ showDialog: false, formDialog: false }) function verifyUser () { console.log(globalState) if (globalState.auth) { state.formDialog = true } else { Dialog.create({ cancel: true, persistent: true, title: 'Login required', message: 'We love that you want to contribute to our cause. Please login to proceed. Thank you so much!.' }).onOk(() => { console.log('go to login') }) } } return { state, verifyUser } }, data () { return { value: false } } }) </script>