mizzkey/src/client/pages/test.vue

78 lines
1.8 KiB
Vue
Raw Normal View History

2020-09-05 11:14:42 +09:00
<template>
<div>
<portal to="header"><fa :icon="faExclamationTriangle"/>TEST</portal>
<div class="_card">
<div class="_title">Dialog</div>
<div class="_content">
<mk-input v-model:value="dialogTitle">
<span>Title</span>
</mk-input>
2020-09-05 14:33:42 +09:00
<mk-input v-model:value="dialogBody">
<span>Body</span>
</mk-input>
<mk-switch v-model:value="dialogCancel">
<span>With cancel button</span>
</mk-switch>
2020-09-05 21:52:36 +09:00
<mk-switch v-model:value="dialogCancelByBgClick">
<span>Can cancel by modal bg click</span>
</mk-switch>
2020-09-05 15:46:02 +09:00
<mk-switch v-model:value="dialogInput">
<span>With input field</span>
</mk-switch>
2020-09-05 11:14:42 +09:00
<mk-button @click="showDialog()">Show</mk-button>
</div>
2020-09-05 13:04:59 +09:00
<div class="_content">
<span>Result: {{ dialogResult }}</span>
</div>
2020-09-05 11:14:42 +09:00
</div>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import MkButton from '../components/ui/button.vue';
import MkInput from '../components/ui/input.vue';
2020-09-05 14:33:42 +09:00
import MkSwitch from '../components/ui/switch.vue';
2020-09-05 11:14:42 +09:00
export default defineComponent({
components: {
MkButton,
MkInput,
2020-09-05 14:33:42 +09:00
MkSwitch,
2020-09-05 11:14:42 +09:00
},
metaInfo() {
return {
title: this.$t('notFound') as string
};
},
data() {
return {
2020-09-05 14:33:42 +09:00
dialogTitle: 'Hello',
dialogBody: 'World!',
dialogCancel: false,
2020-09-05 21:52:36 +09:00
dialogCancelByBgClick: true,
2020-09-05 15:46:02 +09:00
dialogInput: false,
dialogResult: null,
2020-09-05 11:14:42 +09:00
faExclamationTriangle
}
},
methods: {
2020-09-05 13:04:59 +09:00
async showDialog() {
2020-09-05 21:52:36 +09:00
this.dialogResult = null;
2020-09-05 13:04:59 +09:00
this.dialogResult = await this.$store.dispatch('showDialog', {
2020-09-05 11:14:42 +09:00
title: this.dialogTitle,
2020-09-05 14:33:42 +09:00
text: this.dialogBody,
showCancelButton: this.dialogCancel,
2020-09-05 21:52:36 +09:00
cancelableByBgClick: this.dialogCancelByBgClick,
2020-09-05 15:46:02 +09:00
input: this.dialogInput ? {} : null
2020-09-05 13:04:59 +09:00
});
2020-09-05 11:14:42 +09:00
}
}
});
</script>