找不到匹配的域名时可以指定默认域名、指定不匹配时的处理动作

This commit is contained in:
刘祥超
2020-11-18 12:17:50 +08:00
parent 850d343809
commit db770ab2a8
7 changed files with 157 additions and 30 deletions

View File

@@ -1,5 +1,5 @@
Vue.component("values-box", {
props: ["values", "size", "maxlength", "name"],
props: ["values", "size", "maxlength", "name", "placeholder"],
data: function () {
let values = this.values;
if (values == null) {
@@ -32,6 +32,10 @@ Vue.component("values-box", {
}, 200);
},
confirm: function () {
if (this.value.length == 0) {
return
}
if (this.isUpdating) {
Vue.set(this.vValues, this.index, this.value);
} else {
@@ -50,30 +54,31 @@ Vue.component("values-box", {
this.value = "";
}
},
template: '<div>\
<div style="margin-bottom: 1em" v-if="vValues.length > 0">\
<div class="ui label tiny" v-for="(value, index) in vValues" style="margin-top:0.4em;margin-bottom:0.4em">{{value}}\
<input type="hidden" :name="name" :value="value"/>\
&nbsp; <a href="" @click.prevent="update(index)" title="修改"><i class="icon pencil small" ></i></a> \
<a href="" @click.prevent="remove(index)" title="删除"><i class="icon remove"></i></a> \
</div> \
</div> \
template: `<div>
<div style="margin-bottom: 1em" v-if="vValues.length > 0">
<div class="ui label tiny" v-for="(value, index) in vValues" style="margin-top:0.4em;margin-bottom:0.4em">{{value}}
<input type="hidden" :name="name" :value="value"/>
&nbsp; <a href="" @click.prevent="update(index)" title="修改"><i class="icon pencil small" ></i></a>
<a href="" @click.prevent="remove(index)" title="删除"><i class="icon remove"></i></a>
</div>
<div class="ui divider"></div>
</div>
<!-- 添加|修改 -->\
<div v-if="isAdding || isUpdating">\
<div class="ui fields inline">\
<div class="ui field">\
<input type="text" :size="size" :maxlength="maxlength" v-model="value" ref="value" @keyup.enter="confirm()" @keypress.enter.prevent="1"/>\
</div> \
<div class="ui field">\
<button class="ui button small" type="button" @click.prevent="confirm()">确定</button> \
</div>\
<div class="ui field">\
<a href="" @click.prevent="cancel()">取消</a> \
</div> \
</div> \
</div> \
<div v-if="!isAdding && !isUpdating">\
<button class="ui button small" type="button" @click.prevent="create()">+</button> \
</div>\
</div>'
<div v-if="isAdding || isUpdating">
<div class="ui fields inline">
<div class="ui field">
<input type="text" :size="size" :maxlength="maxlength" :placeholder="placeholder" v-model="value" ref="value" @keyup.enter="confirm()" @keypress.enter.prevent="1"/>
</div>
<div class="ui field">
<button class="ui button small" type="button" @click.prevent="confirm()">确定</button>
</div>
<div class="ui field">
<a href="" @click.prevent="cancel()">取消</a>
</div>
</div>
</div>
<div v-if="!isAdding && !isUpdating">
<button class="ui button small" type="button" @click.prevent="create()">+</button>
</div>
</div>`
});