更新记录
1.0.2(2024-07-09) 下载此版本
修复bug
1.0.1(2024-07-09) 下载此版本
更新readme.md
平台兼容性
uni-app x
Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
---|---|---|---|---|---|
√ | √ | 5.0 | 12 | - | √ |
其他
多语言 | 暗黑模式 | 宽屏模式 |
---|---|---|
× | × | √ |
math-exp
用法
import { MathExp } from '@/uni_modules/math-exp'
const exp = new MathExp()
const mathExp: string = `((price * 0.2) + ratio) / 5`
const options: any = {
price: 1500.5,
ratio: 3.2
}
const result: number | null = exp.eval(mathExp, options)
if (result == null) {
console.log('表达式不合法')
} else {
console.log('计算结果为:', result)
}