Vue.component("http-cache-config-box", { props: ["v-cache-config", "v-cache-policies", "v-is-location"], data: function () { let cacheConfig = this.vCacheConfig if (cacheConfig == null) { cacheConfig = { isPrior: false, isOn: false, cacheRefs: [] } } return { cacheConfig: cacheConfig } }, methods: { isOn: function () { return (!this.vIsLocation || this.cacheConfig.isPrior) && this.cacheConfig.isOn }, addRef: function () { window.UPDATING_CACHE_REF = null let width = window.innerWidth if (width > 1024) { width = 1024 } let height = window.innerHeight if (height > 500) { height = 500 } let that = this teaweb.popup("/servers/server/settings/cache/createPopup", { width: width + "px", height: height + "px", callback: function (resp) { that.cacheConfig.cacheRefs.push(resp.data.cacheRef) } }) }, updateRef: function (index, cacheRef) { window.UPDATING_CACHE_REF = cacheRef let width = window.innerWidth if (width > 1024) { width = 1024 } let height = window.innerHeight if (height > 500) { height = 500 } let that = this teaweb.popup("/servers/server/settings/cache/createPopup", { width: width + "px", height: height + "px", callback: function (resp) { Vue.set(that.cacheConfig.cacheRefs, index, resp.data.cacheRef) } }) }, removeRef: function (index) { let that = this teaweb.confirm("确定要删除此缓存设置吗?", function () { that.cacheConfig.cacheRefs.$remove(index) }) }, timeUnitName: function (unit) { switch (unit) { case "ms": return "毫秒" case "second": return "秒" case "minute": return "分钟" case "hour": return "小时" case "day": return "天" case "week": return "周 " } return unit } }, template: `
` })