This is an automated email from the ASF dual-hosted git repository. juzhiyuan pushed a commit to branch fix-plugin-oneof in repository https://gitbox.apache.org/repos/asf/incubator-apisix-dashboard.git
commit 2415ea40e470f4694788d16788799fda2a5233da Author: juzhiyuan <jjzhiy...@gmail.com> AuthorDate: Wed Oct 30 16:06:00 2019 +0800 update prop --- src/components/PluginDialog/index.vue | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/PluginDialog/index.vue b/src/components/PluginDialog/index.vue index 2a3f466..fbcb900 100644 --- a/src/components/PluginDialog/index.vue +++ b/src/components/PluginDialog/index.vue @@ -52,14 +52,13 @@ </el-form-item> <el-form-item - v-for="(value, index) in data['values']" + v-for="(value, index) in data.values" :key="index" :label="'Value' + (index + 1)" :rules="{ required: true, trigger: 'blur' }" > - {{ data.values.length }} <el-input v-model="data['values'][index]" /> <el-button v-if="data.values.length !== 1" @@ -264,6 +263,7 @@ export default class extends Vue { (this.$refs.form as any).validate((valid: boolean) => { // 标记该插件数据是否通过校验 if (valid) { + this.data = this.processOneOfProp(this.data) this.$emit('save', this.name, this.data) this.$message.warning('Your data will be saved after you click the Save button') } else { @@ -292,6 +292,16 @@ export default class extends Vue { private removeOneOfPropValue(index: number) { this.data.values = this.data.values.filter((item: any, _index: number) => index !== _index) } + + private processOneOfProp(data: any) { + if (!this.schema.oneOf) { + return data + } + + return { + [this.data.radioKey]: this.data.values + } + } } </script>