juzhiyuan commented on a change in pull request #170: feature: add object
property editor
URL:
https://github.com/apache/incubator-apisix-dashboard/pull/170#discussion_r404772884
##########
File path: src/components/PluginDialog/index.vue
##########
@@ -355,6 +401,56 @@ export default class extends Vue {
}
}
+ /**
+ * Add item to object property
+ * @param key
+ */
+ private addObjectItem(key: any) {
+ this.objectPropertiesArray[key].push({
+ key: '',
+ value: ''
+ })
+ this.isDataChanged = true
+ this.$forceUpdate()
+ }
+
+ /**
+ * Delete item form object property
+ * @param key
+ * @param index
+ */
+ private deleteObjectItem(key: any, index: number) {
+ this.objectPropertiesArray[key].splice(index, 1)
+ this.isDataChanged = true
+ this.$forceUpdate()
+ }
+
+ /**
+ * Reorganize an array of object properties into objects
+ */
+ private reorganizeObjectProperty() {
+ let data = {}
+ for (let i in this.objectPropertiesArray) {
+ let objectItem = {}
+ this.objectPropertiesArray[i].map((item: any) => {
+ objectItem[item.key] = item.value
+ })
+ data[i] = objectItem
+ }
+ return data
+ }
+
+ /**
+ * Force rerender on object property content changed
+ * @param key
+ * @param value
+ * @param isKey
+ */
+ private onObjectPropertyChange(key: any, value: any, isKey: boolean) {
Review comment:
those parameters are unused?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services