Skip to content

Instantly share code, notes, and snippets.

@enappd
Created June 7, 2021 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enappd/8732d8d2412b6f14fb1c3cc77e696ba7 to your computer and use it in GitHub Desktop.
Save enappd/8732d8d2412b6f14fb1c3cc77e696ba7 to your computer and use it in GitHub Desktop.
Ionic Vue new app
<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