Created
June 7, 2021 04:19
-
-
Save enappd/8732d8d2412b6f14fb1c3cc77e696ba7 to your computer and use it in GitHub Desktop.
Ionic Vue new app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script lang="ts"> | |
import { defineComponent } from 'vue'; | |
import { IonButton, IonPage , alertController} from '@ionic/vue'; | |
import { useRouter } from "vue-router"; | |
export default defineComponent({ | |
name: 'Page', | |
components: { | |
IonPage, | |
IonButton | |
}, | |
ionViewDidEnter() { | |
this.presentAlert(); | |
}, | |
methods: { | |
async presentAlert() { | |
const alert = await alertController | |
.create({ | |
cssClass: 'my-custom-class', | |
header: 'Alert', | |
subHeader: 'Ionic Vue', | |
message: 'This alert is triggered on ionViewDidEnter', | |
buttons: ['OK'], | |
}); | |
await alert.present(); | |
const { role } = await alert.onDidDismiss(); | |
console.log('onDidDismiss resolved with role', role); | |
} | |
}, | |
setup() { | |
const router = useRouter(); | |
return { router }; | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment