添加后恢复初始状态

This commit is contained in:
q4speed 2020-05-21 16:20:18 +08:00
parent d6da86b7b5
commit 7f8707391b
6 changed files with 30 additions and 8 deletions

View File

@ -39,7 +39,8 @@
default: false
},
index: Number,
list: Array
list: Array,
callback: Function
},
data() {
@ -51,6 +52,7 @@
methods: {
add: function () {
this.list.push(new Regex(this.regex));
this.callback();
},
remove: function () {
this.list.splice(this.index, 1);

View File

@ -21,7 +21,8 @@
props: {
edit: Boolean,
duration: ResponseTime
duration: ResponseTime,
callback: Function
},
data() {
@ -34,6 +35,7 @@
add: function () {
setTimeout(() => {
this.duration.value = this.time;
this.callback();
})
},
remove: function () {

View File

@ -37,7 +37,8 @@
name: "MsApiAssertionText",
props: {
list: Array
list: Array,
callback: Function
},
data() {
@ -52,6 +53,7 @@
methods: {
add: function () {
this.list.push(this.toRegex());
this.callback();
},
toRegex: function () {
let expression = "";

View File

@ -10,9 +10,10 @@
</el-select>
</el-col>
<el-col :span="20">
<ms-api-assertion-text :list="assertions.regex" v-if="type === options.TEXT"/>
<ms-api-assertion-regex :list="assertions.regex" v-if="type === options.REGEX"/>
<ms-api-assertion-response-time :duration="assertions.duration" v-if="type === options.RESPONSE_TIME"/>
<ms-api-assertion-text :list="assertions.regex" v-if="type === options.TEXT" :callback="after"/>
<ms-api-assertion-regex :list="assertions.regex" v-if="type === options.REGEX" :callback="after"/>
<ms-api-assertion-response-time :duration="assertions.duration" v-if="type === options.RESPONSE_TIME"
:callback="after"/>
</el-col>
</el-row>
@ -41,7 +42,14 @@
options: ASSERTION_TYPE,
type: "",
}
},
methods: {
after() {
this.type = "";
}
}
}
</script>

View File

@ -13,7 +13,7 @@
</el-select>
</el-col>
<el-col :span="20">
<ms-api-extract-common :extract-type="type" :list="list" v-if="type"/>
<ms-api-extract-common :extract-type="type" :list="list" v-if="type" :callback="after"/>
</el-col>
</el-row>
@ -45,6 +45,12 @@
}
},
methods: {
after() {
this.type = "";
}
},
computed: {
list() {
switch (this.type) {

View File

@ -41,7 +41,8 @@
default: false
},
index: Number,
list: Array
list: Array,
callback: Function
},
data() {
@ -54,6 +55,7 @@
add() {
this.list.push(new ExtractCommon(this.extractType, this.common));
this.clear();
this.callback();
},
change(variable) {
this.common.value = "${" + variable + "}";