diff --git a/web/public/js/components/server/http-request-scripts-config-box.js b/web/public/js/components/server/http-request-scripts-config-box.js index 2439871c..e604216c 100644 --- a/web/public/js/components/server/http-request-scripts-config-box.js +++ b/web/public/js/components/server/http-request-scripts-config-box.js @@ -10,12 +10,12 @@ Vue.component("http-request-scripts-config-box", { } }, methods: { - changeInitScript: function (scriptConfig) { - this.config.onInitScript = scriptConfig + changeInitGroup: function (group) { + this.config.initGroup = group this.$forceUpdate() }, - changeRequestScript: function (scriptConfig) { - this.config.onRequestScript = scriptConfig + changeRequestGroup: function (group) { + this.config.requestGroup = group this.$forceUpdate() } }, @@ -25,12 +25,12 @@ Vue.component("http-request-scripts-config-box", {

请求初始化

在请求刚初始化时调用,此时自定义Header等尚未生效。

- +

准备发送请求

在准备执行请求或者转发请求之前调用,此时自定义Header、源站等已准备好。

- +
` diff --git a/web/public/js/components/server/script-group-config-box.js b/web/public/js/components/server/script-group-config-box.js new file mode 100644 index 00000000..82759bd0 --- /dev/null +++ b/web/public/js/components/server/script-group-config-box.js @@ -0,0 +1,38 @@ +Vue.component("script-group-config-box", { + props: ["v-group"], + data: function () { + let group = this.vGroup + if (group == null) { + group = { + isPrior: false, + isOn: true, + scripts: [] + } + } + if (group.scripts == null) { + group.scripts = [] + } + + let script = null + if (group.scripts.length > 0) { + script = group.scripts[group.scripts.length - 1] + } + + return { + group: group, + script: script + } + }, + methods: { + changeScript: function (script) { + this.group.scripts = [script] // 目前只支持单个脚本 + this.change() + }, + change: function () { + this.$emit("change", this.group) + } + }, + template: `
+ +
` +}) \ No newline at end of file