表格搜索

<el-curd>组件表格搜索方式可自定义

<div id="app" v-cloak>
    <el-curd
        ref="curd"
        :field="field">
        <template v-slot:search>
            <div class="el-search-item">
                <div class="label">属性标签:</div>
                <div class="value">
                    <el-select v-model="attr" placeholder="查看所有属性" @change="searchData()" size="small" filterable>
                        <el-option label="全部" value=""></el-option>
                        <el-option label="热门" value="ishot"></el-option>
                        <el-option label="置顶" value="istop"></el-option>
                        <el-option label="推荐" value="isrecommend"></el-option>
                    </el-select>
                </div>
            </div>
        </template>
    </el-curd>
</div>
<script>
    new Vue({
        el: '#app',
        data() {
            return {
                attr:'',
                field: [],
            }
        },
        methods: {
            searchData() {
                this.$refs.curd.search = Object.assign({}, this.$refs.curd.search, {page: 1, attr: this.attr});
            },
        }
    });
</script>

 

文档最后更新时间:2023-03-16 10:06:23