✨ 搜索框支持 spk 链接跳转
This commit is contained in:
@@ -18,7 +18,17 @@ const TitleBar: Component<TitleBarProps> = (props) => {
|
||||
|
||||
const handleSearch = () => {
|
||||
if (searchInput?.value) {
|
||||
if (searchInput.value.startsWith('spk://')) {
|
||||
// 处理 spk:// 协议
|
||||
const path = searchInput.value.replace('spk://', '');
|
||||
const parts = path.split('/');
|
||||
const category = parts[parts.length - 2];
|
||||
const pkgname = parts[parts.length - 1];
|
||||
navigate(`/app/${category}/${pkgname}`);
|
||||
} else {
|
||||
// 处理普通搜索
|
||||
navigate(`/search?q=${encodeURIComponent(searchInput.value)}`);
|
||||
}
|
||||
searchInput.value = "";
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user