build / build (push) Successful in 3m10s
- A 类主题 loader 原文接入 + env-config 引导 + vite /static 与 /api(8086) 代理(P6/P11)
- GetUserMod 左导航:utils/menuNav.ts 单点实现 path 空锚点跳过、分组收敛、icon 兜底、面包屑基线(对齐 Notice 13afb22 refined 版)
- alova 封装 + api/module/base.ts(getUserMod 可选 appCode,P2 定名;H4 前空树不回落,P3)
- 路由骨架一 SPA 四形态:/admin/{forms,data,stats,dicts}、/f/:code、/app/:appCode/*、/my;self!=top 剥壳(方案 §3.3)
- 规范件落位:tableActions.ts(UserBase 同构源,正文 MD5 不变)、TablePageAlovaNew + useElementHeight、page-wrapper yh-fill 骨架
- view-ui-plus 精确锁 1.3.24;本地零 layout.css/icons.css;avatar 两件由 YschTheme sync 下发
- 剥除:notice 领域 views/api/mock/menu 兜底、alova-vant(mobiapi)、ztree+jquery 与重依赖(按需回补,见 service/docs/T5-report.md 问题单 P52)
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import type { App } from "vue";
|
|
|
|
export default (app: App<Element>): void => {
|
|
app.directive("real-img", {
|
|
async mounted(el, binding) {
|
|
console.log(el);
|
|
if (el.getAttribute("data-load") == null) el.classList.add("img-hide");
|
|
let imgURL = binding.value; //获取图片地址
|
|
|
|
if (imgURL) {
|
|
let exist = await imageIsExist(imgURL);
|
|
if (exist) {
|
|
el.setAttribute("src", imgURL);
|
|
el.setAttribute("data-load", "1");
|
|
}
|
|
}
|
|
el.classList.remove("img-hide");
|
|
},
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 检测图片是否存在
|
|
* @param url
|
|
*/
|
|
let imageIsExist = function (url: string) {
|
|
return new Promise(resolve => {
|
|
var img: HTMLImageElement | null = new Image();
|
|
img.onload = function () {
|
|
if ((this as any).complete == true) {
|
|
resolve(true);
|
|
img = null;
|
|
}
|
|
};
|
|
img.onerror = function () {
|
|
resolve(false);
|
|
img = null;
|
|
};
|
|
img.src = url;
|
|
});
|
|
};
|