更新记录
1.0.0(2026-09-15) 下载此版本
- 首次发布:近体诗(五/七绝、五/七律)平仄教学检测
- 支持平水韵 / 中华新韵韵脚对照
- 支持自动匹配体式、「一三五不论」通融与严格模式
- 提供 Vue 教学组件与
analyzePoem/analyzeCoupletAPI - 内置教学常用字库,支持
extendDict扩展
平台兼容性
uni-app(4.45)
| Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
|---|---|---|---|---|---|---|---|---|
| √ | √ | √ | √ | √ | √ | √ | √ | √ |
| 微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 小红书小程序 | 快应用-华为 | 快应用-联盟 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |
uni-app x(4.45)
| Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
|---|---|---|---|---|---|
| √ | √ | √ | √ | √ | √ |
zy-poem-meter(诗词格律教学助手)
近体诗 / 对联 教学辅助 工具:对照格律模板检查平仄,按平水韵或中华新韵检查韵脚,失律字标色并给出讲解。
定位:课堂教学与自学对照,不是审定或创作权威工具。多音字、通押、入声等请以教材与教师讲解为准。
能做什么
| 能力 | 说明 |
|---|---|
| 近体诗平仄 | 五/七言绝句、律诗;平起/仄起;首句入韵/不入韵 |
| 自动匹配体式 | 未选手动模板时,按失律最少推荐体式 |
| 韵脚检测 | 平水韵(教学)/ 中华新韵(教学) |
| 一三五不论 | 默认通融奇数位,可开「严格模式」 |
| 对联辅助 | 字数、平仄相对、上仄下平提示(API) |
| 字库扩展 | extendDict 补自家教材用字 |
纯 JS,无原生依赖;可跑在 H5 / 小程序 / App(含鸿蒙 Next 的 uni-app 前端)。
安装
导入后目录:uni_modules/zy-poem-meter/
- 组件:
components/zy-poem-meter/zy-poem-meter.vue - API:
utils/index.js - 示例:
example/PoemMeterDemo.vue
组件快速使用
<template>
<zy-poem-meter v-model="text" rhyme-book="pingshui" @analyzed="onDone" />
</template>
<script>
export default {
data() {
return { text: '白日依山尽,黄河入海流。欲穷千里目,更上一层楼。' }
},
methods: {
onDone(res) {
console.log(res.pass, res.formName, res.pingze, res.rhyme)
}
}
}
</script>
easycom(uni_modules)下一般无需手动注册。
Props
| 属性 | 类型 | 默认 | 说明 |
|---|---|---|---|
| modelValue / value | String | '' |
诗句文本 |
| formId | String | '' |
空=自动匹配;如 wujue-ze-buyun |
| rhymeBook | String | pingshui |
pingshui | xinyun |
| strict | Boolean | false |
严格模式(关闭一三五通融) |
| showToolbar | Boolean | true |
显示体式/韵书工具栏 |
| showInput | Boolean | true |
显示输入框 |
事件
analyzed:完整分析结果charClick:点击某字update:modelValue/input
API 使用
import {
analyzePoem,
analyzeCouplet,
analyzeChar,
extendDict,
listForms
} from '@/uni_modules/zy-poem-meter/utils'
const res = analyzePoem('白日依山尽,黄河入海流。欲穷千里目,更上一层楼。', {
rhymeBook: 'pingshui',
strict: false
})
console.log(res.formName, res.pass)
console.log(res.pingze.errors)
console.log(res.rhyme.feet)
const dui = analyzeCouplet('海内存知己', '天涯若比邻')
extendDict([{ char: '鹳', tone: 'Z', ps: '', xy: 14 }])
analyzePoem 主要返回字段
formName/formId:匹配到的体式pingze.lines[][]:逐字{ char, expectLabel, actualLabel, status, message }status:ok|error|soft|unknown|poly|missing
rhyme.feet:韵脚字与韵部tips[]:教学提示meta.disclaimer:免责声明
体式 id 一览
- 五绝:
wujue-ze-buyun/wujue-ze-yun/wujue-ping-buyun/wujue-ping-yun - 七绝:
qijue-*(同上后缀) - 五律:
wulv-* - 七律:
qilv-*
用 listForms() 可列出全部。
教学说明
- 二四分明:偶数字位(尤其韵脚)宜严格合律。
- 一三五不论:默认不把奇数位失律判为硬错误;
strict: true可关闭。 - 平水韵 vs 中华新韵:古近体课用平水韵;当代创作课可用中华新韵,二者结论可能不同。
- 字库有限:常见教学用字已收录;生僻字会标「未知」,请
extendDict或查教材。
版本
见 changelog.md

收藏人数:
下载插件并导入HBuilderX
下载示例项目ZIP
赞赏(0)
下载 317
赞赏 5
下载 12603070
赞赏 1949
赞赏
京公网安备:11010802035340号