Browse Source

fix(gui-v2): replace by vModel

pull/2838/head
Wing-Kam Wong 2 years ago
parent
commit
4f73cc14d7
  1. 16
      packages/nc-gui-v2/components/webhook/Drawer.vue

16
packages/nc-gui-v2/components/webhook/Drawer.vue

@ -3,21 +3,15 @@ interface Props {
modelValue: boolean modelValue: boolean
} }
const { modelValue } = defineProps<Props>() const props = defineProps<Props>()
const emit = defineEmits(['update:modelValue'])
const emits = defineEmits(['update:modelValue'])
const editOrAdd = ref(false) const editOrAdd = ref(false)
const webhookEditorRef = ref() const webhookEditorRef = ref()
const dialogShow = computed({ const vModel = useVModel(props, 'modelValue', emits)
get() {
return modelValue
},
set(v: boolean) {
emit('update:modelValue', v)
},
})
async function editHook(hook: Record<string, any>) { async function editHook(hook: Record<string, any>) {
editOrAdd.value = true editOrAdd.value = true
@ -29,7 +23,7 @@ async function editHook(hook: Record<string, any>) {
</script> </script>
<template> <template>
<a-drawer v-model:visible="dialogShow" :closable="false" placement="right" width="700px" @keydown.esc="dialogShow = false"> <a-drawer v-model:visible="vModel" :closable="false" placement="right" width="700px" @keydown.esc="vModel = false">
<WebhookEditor v-if="editOrAdd" ref="webhookEditorRef" @back-to-list="editOrAdd = false" /> <WebhookEditor v-if="editOrAdd" ref="webhookEditorRef" @back-to-list="editOrAdd = false" />
<WebhookList v-else @edit="editHook" @add="editOrAdd = true" /> <WebhookList v-else @edit="editHook" @add="editOrAdd = true" />
<div class="self-center flex flex-column flex-wrap gap-4 items-center mt-4 md:mx-8 md:justify-between justify-center"> <div class="self-center flex flex-column flex-wrap gap-4 items-center mt-4 md:mx-8 md:justify-between justify-center">

Loading…
Cancel
Save