更新记录

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'

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议