Vue.component("dns-resolvers-config-box", { props: ["value", "name"], data: function () { let resolvers = this.value if (resolvers == null) { resolvers = [] } let name = this.name if (name == null || name.length == 0) { name = "dnsResolversJSON" } return { formName: name, resolvers: resolvers, host: "", isAdding: false } }, methods: { add: function () { this.isAdding = true let that = this setTimeout(function () { that.$refs.hostRef.focus() }) }, confirm: function () { let host = this.host.trim() if (host.length == 0) { let that = this setTimeout(function () { that.$refs.hostRef.focus() }) return } this.resolvers.push({ host: host, port: 0, // TODO protocol: "" // TODO }) this.cancel() }, cancel: function () { this.isAdding = false this.host = "" this.port = 0 this.protocol = "" }, remove: function (index) { this.resolvers.$remove(index) } }, template: `
{{resolver.protocol}}{{resolver.host}}:{{resolver.port}}  
 
` })