pages関連

This commit is contained in:
syuilo 2022-12-24 11:57:06 +09:00
parent fabd1f1791
commit b3decf965f
21 changed files with 137 additions and 1228 deletions

View file

@ -21,29 +21,32 @@ import XContainer from '../page-editor.container.vue';
import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue';
import * as os from '@/os';
const props = withDefaults(defineProps<{
value: any
}>(), {
value: {
fileId: null,
},
});
const props = defineProps<{
modelValue: any
}>();
const emit = defineEmits<{
(ev: 'update:modelValue', value: any): void;
}>();
let file: any = $ref(null);
async function choose() {
os.selectDriveFile(false).then((fileResponse: any) => {
file = fileResponse;
props.value.fileId = fileResponse.id;
emit('update:modelValue', {
...props.modelValue,
fileId: fileResponse.id,
});
});
}
onMounted(async () => {
if (props.value.fileId == null) {
if (props.modelValue.fileId == null) {
await choose();
} else {
os.api('drive/files/show', {
fileId: props.value.fileId,
fileId: props.modelValue.fileId,
}).then(fileResponse => {
file = fileResponse;
});