修复tabs query bug 代码优化

This commit is contained in:
吕金泽
2022-03-20 19:50:51 +08:00
parent 4bcd0cfc3b
commit 61aa570cf2
9 changed files with 56 additions and 52 deletions
@@ -28,7 +28,10 @@ const emit = defineEmits(['update:modelValue', 'change'])
const magicTable = ref()
const props = defineProps({
modelValue: Array,
modelValue: {
type: Array,
default: () => []
},
cols: {
type: Array,
default: () => []
@@ -36,11 +39,15 @@ const props = defineProps({
showNo: {
type: Boolean,
default: true
},
operation: {
type: Boolean,
default: true
}
})
const tableOptions = reactive({
data: [],
data: props.modelValue,
cols: [],
showNo: props.showNo
})
@@ -48,25 +55,26 @@ const tableOptions = reactive({
for (var i in props.cols) {
var col = props.cols[i]
tableOptions.cols.push({
type: 'dynamic',
field: col.field,
label: col.label
...col,
type: 'dynamic'
})
}
tableOptions.cols.push({
label: '操作',
type: 'btns',
width: 85,
fixed: 'right',
btns: [{
label: '删除',
type: 'danger',
click: (row, index) => {
tableOptions.data.splice(index, 1)
}
}]
})
if(props.operation){
tableOptions.cols.push({
label: '操作',
type: 'btns',
width: 85,
fixed: 'right',
btns: [{
label: '删除',
type: 'danger',
click: (row, index) => {
tableOptions.data.splice(index, 1)
}
}]
})
}
watch(() => props.modelValue, (value) => {
console.log(value)
@@ -56,10 +56,6 @@ for(var key in props.where){
}
}
watch(() => props.where,() => {
console.log(props.where)
})
const emit = defineEmits(['search', 'mounted'])
function input(input){
@@ -75,10 +75,6 @@ const props = defineProps({
}
})
watch(() => props.checkedIds, (value) => {
console.log(value)
})
const tree = ref()
const treeData = ref([])
const searchData = ref([])