更新记录
1.0.2(2026-05-27) 下载此版本
- 修复 iOS 编译报错:
uni_modules/MrS590-pinyin-match/utssdk/app-iosc/index.swift出现expressions are not allowed at the top level。 - 将 iOS 入口
uni_modules/MrS590-pinyin-match/utssdk/app-ios/index.uts中的export const name: Type = function (...) {}改为export function name(...),避免 HBuilderX 生成 Swift 顶层表达式。
1.0.1(2026-04-07) 下载此版本
修复字典误映射:uni_modules/MrS590-pinyin-match/utssdk/pinyin-match.uts:32
- 从 SIMPLIFIED_DICT.set("an", "...厂广") 改为 SIMPLIFIED_DICT.set("an", "...厂") 避免 getInitials("广州") 因为“取第一个拼音”而变成 az
1.0.0(2026-02-04) 下载此版本
- 首次发布:
pinyinMatch+getInitials(纯 UTS 实现,内置简体拼音字典)。
平台兼容性
uni-app x(3.7.8)
| Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
|---|---|---|---|---|---|
| √ | √ | √ | √ | √ | √ |
MrSeven590-pinyin-match
为 uni-app-x(以及 uni-app Web 构建)提供的纯 UTS 拼音匹配插件。
本插件基于 pinyin-match 的核心匹配逻辑,使用纯 UTS 重新实现,并内置简体拼音字典。
原作者 xmflswood,项目地址:https://github.com/xmflswood/pinyin-match
API
pinyinMatch(input: string, keyword: string): boolean
支持的匹配模式:
- 原文包含匹配(忽略大小写)
- 拼音全拼匹配(如
zhang匹配张) - 拼音首字母匹配(如
zs匹配张三)
getInitials(cn: string): string
获取中文字符串的拼音首字母(如 张三 -> zs)。
使用方式(uni-app x / .uvue)
import { pinyinMatch, getInitials } from '@/uni_modules/MrS590-pinyin-match'
const a = pinyinMatch('张三', 'zhang') // true
const b = pinyinMatch('张三', 'zs') // true
const c = getInitials('张三') // 'zs'

收藏人数:
下载插件并导入HBuilderX
赞赏(0)
下载 21
赞赏 0
下载 12288439
赞赏 1922
赞赏
京公网安备:11010802035340号