Vue.component("node-cache-disk-dirs-box", { props: ["value", "name"], data: function () { let dirs = this.value if (dirs == null) { dirs = [] } return { dirs: dirs, isEditing: false, isAdding: false, addingPath: "" } }, methods: { add: function () { this.isAdding = true let that = this setTimeout(function () { that.$refs.addingPath.focus() }, 100) }, confirm: function () { let addingPath = this.addingPath.trim() if (addingPath.length == 0) { let that = this teaweb.warn("请输入要添加的缓存目录", function () { that.$refs.addingPath.focus() }) return } if (addingPath[0] != "/") { addingPath = "/" + addingPath } this.dirs.push({ path: addingPath }) this.cancel() }, cancel: function () { this.addingPath = "" this.isAdding = false this.isEditing = false }, remove: function (index) { let that = this teaweb.confirm("确定要删除此目录吗?", function () { that.dirs.$remove(index) }) } }, template: `
` })