Page({
    data: {
        list: [
            "标签1",
            "标签2",
            "标签22",
            "标签21231231",
            "标签212胜多负少",
            "标签223423SDf",
            "标签2dsf sdf让他水电费",
            "标签3"
        ],
        copy: [
            "标签1",
            "标签2",
            "标签22",
            "标签21231231",
            "标签212胜多负少",
            "标签223423SDf",
            "标签2dsf sdf让他水电费",
            "标签3"
        ],
        ownerid: 0,
        ownertable: 0,
        actives: [],
    },
    onLoad(options) {
        if (options.ownertable) this.setData({
            ...options
        })
    },
    onChange(e) {
        const {
            tag
        } = e.target.dataset;
        if (!tag) return;
        let actives = this.data.actives;
        if (actives.some(v => v == tag)) {
            actives = actives.filter(v => v != tag)
        } else {
            actives.push(tag)
        }
        this.setData({
            actives
        })
    },
    /* 搜索 */
    onInput({
        detail
    }) {
        this.setData({
            list: detail == '' ? this.data.copy : this.data.copy.filter(v => v.includes(detail))
        })
    },
})