Vue.component("http-header-replace-values", { props: ["v-replace-values"], data: function () { let values = this.vReplaceValues if (values == null) { values = [] } return { values: values, isAdding: false, addingValue: {"pattern": "", "replacement": "", "isCaseInsensitive": false, "isRegexp": false} } }, methods: { add: function () { this.isAdding = true let that = this setTimeout(function () { that.$refs.pattern.focus() }) }, remove: function (index) { this.values.$remove(index) }, confirm: function () { let that = this if (this.addingValue.pattern.length == 0) { teaweb.warn("替换前内容不能为空", function () { that.$refs.pattern.focus() }) return } this.values.push(this.addingValue) this.cancel() }, cancel: function () { this.isAdding = false this.addingValue = {"pattern": "", "replacement": "", "isCaseInsensitive": false, "isRegexp": false} } }, template: `
` })