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

103 lines
2.2 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">code</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-radio-group v-model="mode">
<v-row>
<v-col>
<v-radio label="链接" value="link"/>
</v-col>
<v-col>
<v-radio label="脚本" value="script"/>
</v-col>
</v-row>
</v-radio-group>
<v-textarea
clearable
clear-icon="clear"
solo
auto-grow
:label="hint"
v-model="content"
/>
</v-card-text>
</v-card>
</template>
<script>
export default {
props: ["args"],
data: function () {
return {
idx: this.$vnode.key,
mode: "link",
content: ""
}
},
computed: {
hint() {
return this.mode === 'link' ? "请输入链接地址" : "请输入一段脚本"
}
},
created() {
if (typeof this.args !== 'undefined') {
this.mode = this.args.mode;
this.content = this.args.content;
}
},
watch: {
mode() {
this.save();
},
content() {
this.save();
}
},
methods: {
save() {
if (this.content) {
this.$emit("dataChanged", {
idx: this.idx,
args: {
mode: this.mode,
content: this.content
}
});
}
}
}
}
</script>
<style scoped>
</style>