misskey/src/client/pages/test.vue

109 lines
2.4 KiB
Vue
Raw Normal View History

2020-09-05 02:14:42 +00:00
<template>
<div>
<portal to="header"><fa :icon="faExclamationTriangle"/>TEST</portal>
2020-09-20 12:29:22 +00:00
<div class="_card _vMargin">
2020-09-05 02:14:42 +00:00
<div class="_title">Dialog</div>
<div class="_content">
<mk-input v-model:value="dialogTitle">
<span>Title</span>
</mk-input>
2020-09-05 05:33:42 +00: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 12:52:36 +00:00
<mk-switch v-model:value="dialogCancelByBgClick">
<span>Can cancel by modal bg click</span>
</mk-switch>
2020-09-05 06:46:02 +00:00
<mk-switch v-model:value="dialogInput">
<span>With input field</span>
</mk-switch>
2020-09-05 02:14:42 +00:00
<mk-button @click="showDialog()">Show</mk-button>
</div>
2020-09-05 04:04:59 +00:00
<div class="_content">
<span>Result: {{ dialogResult }}</span>
</div>
2020-09-05 02:14:42 +00:00
</div>
2020-09-20 12:29:22 +00:00
<div class="_card _vMargin">
<div class="_title">MFM</div>
<div class="_content">
<mk-textarea v-model:value="mfm">
<span>MFM</span>
</mk-textarea>
</div>
<div class="_content">
<mfm :text="mfm"/>
</div>
</div>
2020-09-20 12:37:09 +00:00
<div class="_card _vMargin">
<div class="_title">selectDriveFile</div>
<div class="_content">
<mk-button @click="selectDriveFile()">selectDriveFile</mk-button>
</div>
<div class="_content">
</div>
</div>
2020-09-05 02:14:42 +00:00
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
2020-09-06 03:30:27 +00:00
import MkButton from '@/components/ui/button.vue';
import MkInput from '@/components/ui/input.vue';
import MkSwitch from '@/components/ui/switch.vue';
2020-09-20 12:29:22 +00:00
import MkTextarea from '@/components/ui/textarea.vue';
2020-09-20 12:37:09 +00:00
import { selectDriveFile } from '@/scripts/select-drive-file';
2020-09-06 03:30:27 +00:00
import * as os from '@/os';
2020-09-05 02:14:42 +00:00
export default defineComponent({
components: {
MkButton,
MkInput,
2020-09-05 05:33:42 +00:00
MkSwitch,
2020-09-20 12:29:22 +00:00
MkTextarea,
2020-09-05 02:14:42 +00:00
},
metaInfo() {
return {
title: this.$t('notFound') as string
};
},
data() {
return {
2020-09-05 05:33:42 +00:00
dialogTitle: 'Hello',
dialogBody: 'World!',
dialogCancel: false,
2020-09-05 12:52:36 +00:00
dialogCancelByBgClick: true,
2020-09-05 06:46:02 +00:00
dialogInput: false,
dialogResult: null,
2020-09-20 12:29:22 +00:00
mfm: '',
2020-09-05 02:14:42 +00:00
faExclamationTriangle
}
},
methods: {
2020-09-05 04:04:59 +00:00
async showDialog() {
2020-09-05 12:52:36 +00:00
this.dialogResult = null;
2020-09-06 03:30:27 +00:00
this.dialogResult = await os.dialog({
2020-09-05 02:14:42 +00:00
title: this.dialogTitle,
2020-09-05 05:33:42 +00:00
text: this.dialogBody,
showCancelButton: this.dialogCancel,
2020-09-05 12:52:36 +00:00
cancelableByBgClick: this.dialogCancelByBgClick,
2020-09-05 06:46:02 +00:00
input: this.dialogInput ? {} : null
2020-09-05 04:04:59 +00:00
});
2020-09-20 12:37:09 +00:00
},
async selectDriveFile() {
const files = await selectDriveFile();
2020-09-05 02:14:42 +00:00
}
}
});
</script>