Closed coffin03 closed 1 year ago
isCurrentUrl判断逻辑有误,已解决
isCurrentUrl
请问你是怎么解决的,isCurrentUrl要怎么改
isCurrentUrl
请问你是怎么解决的,isCurrentUrl要怎么改
isCurrentUrl: (to: string, ctx?: any) => {
if (!to) {
return false;
}
const link = normalizeLink(to);
const location = window.location;
let pathname = link;
let search = '';
const idx = link.indexOf('?');
if (~idx) {
pathname = link.substring(0, idx);
search = link.substring(idx);
}
if (search) {
if (pathname !== location.pathname || !location.search) {
return false;
}
const query = qs.parse(search.substring(1));
const currentQuery = qs.parse(location.search.substring(1));
return Object.keys(query).every(
key => query[key] === currentQuery[key]
);
} else if (pathname === location.pathname) {
return true;
} else if (!~pathname.indexOf('http') && ~pathname.indexOf(':')) {
return match(link, {
decode: decodeURIComponent,
strict: ctx?.strict ?? true
})(location.pathname);
}
return false;
},
描述问题:
在react、app多页应用环境中,使用nav联动增删改查,点击后没有高亮效果
截图或视频:
如何复现(请务必完整填写下面内容):
你是如何使用 amis 的? 1、react 中集成amis App多页应用 2、history使用 BrowserHistory模式
amis 版本是什么?请先在最新 beta 版本测试问题是否存在 3.3.0
粘贴有问题的完整
amis schema
代码: