no message

This commit is contained in:
kuaifan 2025-08-09 10:03:45 +08:00
parent 439262b930
commit 70b0538dd5
3 changed files with 46 additions and 5 deletions

View File

@ -318,6 +318,18 @@ export default {
capsule: config,
}
})
;(async () => {
const cache = await $A.IDBJson("microAppsCapsuleCache");
if ($A.isTrue(config.no_cache)) {
if (typeof cache[name] === "undefined") {
return
}
delete cache[name];
} else {
cache[name] = config;
}
await $A.IDBSet("microAppsCapsuleCache", cache);
})()
},
nextZIndex: () => {
if (typeof window.modalTransferIndex === 'number') {
@ -386,6 +398,12 @@ export default {
})
} else {
//
if (!$A.isHave(config.capsule, true)) {
const capsuleCache = await $A.IDBJson("microAppsCapsuleCache");
if ($A.isJson(capsuleCache[config.name])) {
config.capsule = capsuleCache[config.name];
}
}
config.isOpen = false
config.postMessage = () => {}
config.onBeforeClose = () => true

View File

@ -318,8 +318,8 @@ export default {
background: var(--modal-capsule-bgcolor);
border: 1px solid var(--modal-capsule-bor-color);
border-radius: 16px;
transition: box-shadow 0.2s, background 0.2s;
will-change: box-shadow, background;
transition: box-shadow 0.2s, background 0.2s, top 0.2s, right 0.2s;
will-change: box-shadow, background, top, right;
&:hover {
background: var(--modal-capsule-hov-bgcolor);

View File

@ -220,11 +220,34 @@ const timezone = require("dayjs/plugin/timezone");
/**
* 判断是否有
* @param set
* @param val
* @param {boolean} enhanced
* @returns {boolean}
*/
isHave(set) {
return !!(set !== null && set !== "null" && set !== undefined && set !== "undefined" && set);
isHave(val, enhanced = false) {
// 基础检查
if (val === null || val === "null" || val === undefined || val === "undefined" || !val) {
return false;
}
// 增强检查
if (enhanced) {
if (Array.isArray(val)) return val.length > 0;
if (typeof val === 'object' && val.constructor === Object) return Object.keys(val).length > 0;
}
return true;
},
/**
* 判断是否为真
* @param value
* @returns {boolean}
*/
isTrue(value) {
const type = typeof value;
if (type === 'boolean') return value === true;
if (type === 'number') return value === 1;
if (type === 'string') return value.toLowerCase() === 'true' || value === '1';
return false;
},
/**