<template> <el-row> <basic-container> <avue-crud :option="option" :table-loading="loading" :data="dataList" :options="tableOptions" :page="page" :search="query" :permission="permissionList" :before-open="beforeOpen" :sortKey="sortKey" :sortOrder="sortOrder" :default-sort = "{prop: 'statusTime', order: 'String'}" @sort-change="handleSortChange" v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave" @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"> <template slot="menuLeft" > <el-button type="primary" size="small" icon="el-icon-delete" plain ref="form" v-model="form" :option="option" @click="handleDelete">删 除 </el-button> </template> export default { data() { return { column: [ { label: "设备组", prop: "groupId", filters:true, search: "true", dicData:[], //清空 // clearable:false, type: 'tree', rules: [{ required: true, message: "请输入设备名", trigger: "blur" }] },] }}} 基于AVUE 框架 在自定义的删除按钮 绑定 设备组的搜索框 的输入值 输入搜索信息 点击删除按钮 获取到当前输入框的值
时间: 2023-08-27 07:03:16 浏览: 224
el-data-table:element基于element-ui,轻松实现结界
你可以使用AVUE框架来自定义删除按钮,并将设备组的搜索框的输入值与删除按钮绑定。下面是一个示例代码,展示了如何在点击删除按钮时获取当前搜索框的值:
```html
<template>
<el-row>
<basic-container>
<avue-crud
:option="option"
:table-loading="loading"
:data="dataList"
:options="tableOptions"
:page="page"
:search="query"
:permission="permissionList"
:before-open="beforeOpen"
:sortKey="sortKey"
:sortOrder="sortOrder"
:default-sort="{ prop: 'statusTime', order: 'String' }"
@sort-change="handleSortChange"
v-model="form"
ref="crud"
@row-update="rowUpdate"
@row-save="rowSave"
@row-del="rowDel"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
>
<template slot="menuLeft">
<el-button
type="primary"
size="small"
icon="el-icon-delete"
plain
ref="form"
v-model="form"
:option="option"
@click="handleDelete"
>
删除
</el-button>
</template>
</avue-crud>
</basic-container>
</el-row>
</template>
<script>
export default {
data() {
return {
column: [
{
label: "设备组",
prop: "groupId",
filters: true,
search: true,
dicData: [],
//清空
// clearable:false,
type: 'tree',
rules: [
{
required: true,
message: "请输入设备名",
trigger: "blur"
}
]
}
],
form: {}, // 表单数据
query: {}, // 搜索数据
};
},
methods: {
handleDelete() {
// 获取当前搜索框的值
const groupId = this.query.groupId;
console.log(groupId);
// 在这里执行删除操作
},
},
};
</script>
```
在这个示例中,我们在AVue CRUD组件中添加了一个自定义的删除按钮,并将其绑定到`handleDelete`方法。在`handleDelete`方法中,我们可以通过`this.query.groupId`获取当前搜索框的值,并进行相应的操作。请根据实际情况修改代码,并执行适当的删除操作。
阅读全文