Files
Sub-Store/web/src/components/RegexSortOperator.vue
Peng-YM 5aa9b8ceef Sub-Store 1.0版本
1. 移除了所有基于关键词的节点操作,统一使用基于正则表达式的节点操作。
2. UI的大量改进。
2020-12-05 13:39:11 +08:00

114 lines
2.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<v-card class="ml-1 mr-1 mb-1 mt-1">
<v-card-title>
<v-icon left color="primary">sort</v-icon>
正则排序
<v-spacer></v-spacer>
<v-btn icon @click="$emit('up', idx)">
<v-icon>keyboard_arrow_up</v-icon>
</v-btn>
<v-btn icon @click="$emit('down', idx)">
<v-icon>keyboard_arrow_down</v-icon>
</v-btn>
<v-btn icon @click="$emit('deleteProcess', idx)">
<v-icon color="error">mdi-delete</v-icon>
</v-btn>
<v-dialog>
<template #activator="{on}">
<v-btn icon v-on="on">
<v-icon>help</v-icon>
</v-btn>
</template>
<v-card>
<v-card-title class="headline">
正则排序
</v-card-title>
<v-card-text>
根据给出的正则表达式的顺序对节点进行排序无法匹配的节点将会按照正序排列
</v-card-text>
</v-card>
</v-dialog>
</v-card-title>
<v-card-text>
正则表达式
<v-chip-group
column
>
<v-chip
close
close-icon="mdi-delete"
v-for="(item, idx) in items"
:key="idx"
@click="edit(idx)"
@click:close="remove(idx)"
>
{{ item }}
</v-chip>
</v-chip-group>
<v-text-field
placeholder="添加新正则表达式"
clearable
clear-icon="clear"
solo
v-model="form.item"
append-icon="mdi-send"
@click:append="add(form.item)"
@keyup.enter="add(form.item)"
/>
</v-card-text>
</v-card>
</template>
<script>
export default {
props: ['args'],
data: function () {
return {
idx: this.$vnode.key,
selection: null,
currentTag: null,
form: {
item: ""
},
items: []
}
},
created() {
if (this.args) {
this.items = this.args || [];
}
},
watch: {
items() {
this.save();
},
},
methods: {
add(item) {
if (item) {
this.items.push(item);
this.form.item = "";
} else {
this.$store.commit("SET_ERROR_MESSAGE", "正则表达式不能为空!");
}
},
edit(idx) {
this.form.item = this.items[idx];
this.remove(idx);
},
remove(idx) {
this.items.splice(idx, 1);
},
save() {
this.$emit("dataChanged", {
idx: this.idx,
args: this.items
});
},
}
}
</script>
<style scoped>
</style>