fix: 禁用判断

This commit is contained in:
2023-07-22 16:36:36 +08:00
parent 58548f030b
commit 712b61af73

View File

@ -2,7 +2,7 @@
* @Author: zhaojinfeng 121016171@qq.com * @Author: zhaojinfeng 121016171@qq.com
* @Date: 2023-07-18 12:30:07 * @Date: 2023-07-18 12:30:07
* @LastEditors: zhaojinfeng 121016171@qq.com * @LastEditors: zhaojinfeng 121016171@qq.com
* @LastEditTime: 2023-07-22 16:27:38 * @LastEditTime: 2023-07-22 16:36:13
* @FilePath: \vue3\packages\select-table-modal\index.vue * @FilePath: \vue3\packages\select-table-modal\index.vue
* @Description: 模态框选择表格 * @Description: 模态框选择表格
* *
@ -70,7 +70,7 @@
</div> </div>
<template #footer> <template #footer>
<el-space> <el-space>
<el-button :disabled="!selection" type="primary" @click="confirm"> <el-button :disabled="disabled" type="primary" @click="confirm">
确定 确定
</el-button> </el-button>
<el-button @click="showDialog = false"> <el-button @click="showDialog = false">
@ -142,7 +142,14 @@ const showDialog = ref(false)
let tableData = $ref<any[]>([]) let tableData = $ref<any[]>([])
let selection = $ref<any>() let selection = $ref<any>()
let selections = $ref<Record<string, any> | null>(null) let selections = $ref<Record<string, any>[] | null>(null)
const disabled = computed(() => {
if (props.multiple)
return !selections?.length
return !selection
})
function open() { function open() {
if (props.hideButton) if (props.hideButton)