Vue.component("network-addresses-box", { props: ["v-server-type", "v-addresses", "v-protocol"], data: function () { let addresses = this.vAddresses if (addresses == null) { addresses = [] } let protocol = this.vProtocol if (protocol == null) { protocol = "" } return { addresses: addresses, protocol: protocol } }, watch: { "vServerType": function () { this.addresses = [] } }, methods: { addAddr: function () { let that = this teaweb.popup("/servers/addPortPopup?serverType=" + this.vServerType + "&protocol=" + this.protocol, { callback: function (resp) { var addr = resp.data.address; that.addresses.push(addr); if (["https", "https4", "https6"].$contains(addr.protocol)) { this.tlsProtocolName = "HTTPS"; } else if (["tls", "tls4", "tls6"].$contains(addr.protocol)) { this.tlsProtocolName = "TLS"; } } }) }, removeAddr: function (index) { this.addresses.$remove(index); } }, template: `
{{addr.protocol}}://{{addr.host}}*:{{addr.portRange}}
[添加端口绑定]
` })