优化组件显示

This commit is contained in:
刘祥超
2023-02-13 09:44:10 +08:00
parent 836daf2ad9
commit 54bc98e9c1
4 changed files with 62 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
Vue.component("values-box", {
props: ["values", "v-values", "size", "maxlength", "name", "placeholder", "v-allow-empty"],
props: ["values", "v-values", "size", "maxlength", "name", "placeholder", "v-allow-empty", "validator"],
data: function () {
let values = this.values;
if (values == null) {
@@ -44,6 +44,22 @@ Vue.component("values-box", {
}
}
// validate
if (typeof(this.validator) == "function") {
let resp = this.validator.call(this, this.value)
if (typeof resp == "object") {
if (typeof resp.isOk == "boolean" && !resp.isOk) {
if (typeof resp.message == "string") {
let that = this
teaweb.warn(resp.message, function () {
that.$refs.value.focus();
})
}
return
}
}
}
if (this.isUpdating) {
Vue.set(this.realValues, this.index, this.value);
} else {

View File

@@ -190,7 +190,10 @@ Vue.component("http-cache-ref-box", {
<tr v-if="condCategory == 'simple'">
<td class="color-border">{{condComponent.paramsTitle}} *</td>
<td>
<component :is="condComponent.component" :v-cond="ref.simpleCond"></component>
<component :is="condComponent.component" :v-cond="ref.simpleCond" v-if="condComponent.type != 'params'"></component>
<table class="ui table" v-if="condComponent.type == 'params'">
<component :is="condComponent.component" :v-cond="ref.simpleCond"></component>
</table>
</td>
</tr>
<tr v-if="condCategory == 'simple' && condComponent.caseInsensitive">

View File

@@ -716,8 +716,7 @@ Vue.component("http-cond-params", {
this.cond.value = this.versionRangeMinValue + "," + this.versionRangeMaxValue
}
},
template: `<table class="ui table definition">
<tbody>
template: `<tbody>
<tr>
<td style="width: 8em">参数值</td>
<td>
@@ -835,5 +834,5 @@ Vue.component("http-cond-params", {
</td>
</tr>
</tbody>
</table>`
`
})