Vue.component("http-cache-refs-config-box", { props: ["v-cache-refs"], data: function () { let refs = this.vCacheRefs if (refs == null) { refs = [] } return { refs: refs } }, methods: { 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.refs.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.refs, index, resp.data.cacheRef) } }) }, removeRef: function (index) { let that = this teaweb.confirm("确定要删除此缓存设置吗?", function () { that.refs.$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: `
缓存条件 缓存时间 操作
{{cacheRef.life.count}} {{timeUnitName(cacheRef.life.unit)}} 修改   删除
` })