Vue.component("server-group-selector", { props: ["v-groups"], data: function () { let groups = this.vGroups if (groups == null) { groups = [] } return { groups: groups } }, methods: { selectGroup: function () { let that = this let groupIds = this.groups.map(function (v) { return v.id.toString() }).join(",") teaweb.popup("/servers/components/groups/selectPopup?selectedGroupIds=" + groupIds, { callback: function (resp) { that.groups.push(resp.data.group) } }) }, addGroup: function () { let that = this teaweb.popup("/servers/components/groups/createPopup", { callback: function (resp) { that.groups.push(resp.data.group) } }) }, removeGroup: function (index) { this.groups.$remove(index) }, groupIds: function () { return this.groups.map(function (v) { return v.id }) } }, template: `
{{group.name}}  
[选择分组]   [添加分组]
` })