zhang_li
1 year ago
3 changed files with 106 additions and 44 deletions
@ -1,38 +1,84 @@ |
|||||
<template> |
<template> |
||||
|
<div v-for="(item, index) in Butttondata" :key="index"> |
||||
<el-button |
<el-button |
||||
v-for="(item, index) in Butttondata" :key="index" |
|
||||
v-show="!item.hide" |
v-show="!item.hide" |
||||
:type="item.type" |
:type="item.type" |
||||
:color="item.color" |
:color="item.color" |
||||
:link = "item.link ? item.link : false" |
:link="item.link ? item.link : false" |
||||
v-hasPermi="[item.hasPermi] || []" |
v-hasPermi="[item.hasPermi] || []" |
||||
@click="buttonBaseClick(item.name,item,$event)" |
v-if="item.name != 'set'" |
||||
|
@click="buttonBaseClick(item.name, item, $event)" |
||||
> |
> |
||||
<Icon v-if="item.icon" :icon="item.icon" class="mr-1px" /> |
<Icon v-if="item.icon" :icon="item.icon" class="mr-1px" /> |
||||
{{ item.label }} |
{{ item.label }} |
||||
</el-button> |
</el-button> |
||||
|
<!-- 设置按钮 --> |
||||
|
<el-popover |
||||
|
:visible="popoverVisible" |
||||
|
placement="bottom" |
||||
|
:width="300" |
||||
|
trigger="click" |
||||
|
v-if="item.name == 'set'&&!item.hide" |
||||
|
> |
||||
|
<rowDrop |
||||
|
ref="rowDropRef" |
||||
|
@updata-table-columns="updataTableColumns" |
||||
|
:allSchemas="allSchemas" |
||||
|
@closeRowDrop="closeRowDrop" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
/> |
||||
|
<template #reference> |
||||
|
<el-button |
||||
|
v-show="!item.hide" |
||||
|
:type="item.type" |
||||
|
:color="item.color" |
||||
|
:link="item.link ? item.link : false" |
||||
|
v-hasPermi="[item.hasPermi] || []" |
||||
|
@click="buttonBaseClick(item.name, item, $event)" |
||||
|
> |
||||
|
<Icon v-if="item.icon" :icon="item.icon" class="mr-1px" /> |
||||
|
{{ item.label }} |
||||
|
</el-button> |
||||
|
</template> |
||||
|
</el-popover> |
||||
|
</div> |
||||
<slot></slot> |
<slot></slot> |
||||
</template> |
</template> |
||||
<script setup> |
<script setup> |
||||
import { Plus } from '@element-plus/icons-vue' |
import { Plus } from '@element-plus/icons-vue' |
||||
import { clearButtonBlurHandle } from '@/utils/index' |
import { clearButtonBlurHandle } from '@/utils/index' |
||||
const props = defineProps({ |
import rowDrop from '@/components/rowDrop/index.vue' |
||||
|
const props = defineProps({ |
||||
Butttondata: { |
Butttondata: { |
||||
type: Array, |
type: Array, |
||||
default: () => { |
default: () => { |
||||
return [] |
return [] |
||||
} |
} |
||||
}, |
}, |
||||
}) |
allSchemas: { |
||||
|
type: Object, |
||||
|
default: null |
||||
|
} |
||||
|
}) |
||||
|
|
||||
// 传递给父类 |
console.log('buttonsRight', props.Butttondata) |
||||
const emit = defineEmits([ |
// 传递给父类 |
||||
'buttonBaseClick', |
const emit = defineEmits(['buttonBaseClick', 'updataTableColumns']) |
||||
]) |
|
||||
|
|
||||
const buttonBaseClick = (val, item, $event) => { |
const buttonBaseClick = (val, item, $event) => { |
||||
clearButtonBlurHandle($event)//解决el-button点击后颜色不恢复问题 |
clearButtonBlurHandle($event) //解决el-button点击后颜色不恢复问题 |
||||
emit('buttonBaseClick', val, item, $event) |
emit('buttonBaseClick', val, item, $event) |
||||
} |
} |
||||
|
const popoverVisible = ref(false) |
||||
|
// 关闭页面 |
||||
|
const closeRowDrop = () => { |
||||
|
popoverVisible.value = false |
||||
|
} |
||||
|
defineExpose({ |
||||
|
popoverVisible |
||||
|
}) |
||||
|
// 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
emit('updataTableColumns', val) |
||||
|
} |
||||
</script> |
</script> |
Loading…
Reference in new issue