更新记录

1.0.0(2025-08-14) 下载此版本

1.0.0 支持公式绑定和CDN资源配置、虚拟键盘布局配置


平台兼容性

uni-app(4.07)

Vue2 Vue3 Chrome Safari app-vue app-nvue Android iOS 鸿蒙
- -
微信小程序 支付宝小程序 抖音小程序 百度小程序 快手小程序 京东小程序 鸿蒙元服务 QQ小程序 飞书小程序 快应用-华为 快应用-联盟
× × × × × × × × × × ×

uni-app x(4.07)

Chrome Safari Android iOS 鸿蒙 微信小程序
- ×

其他

多语言 暗黑模式 宽屏模式
× ×

Mathlive App 项目说明

本项目基于 uni-app 框架,适配 H5 和 App 端,集成了 mathlive 数学公式编辑器。通过 renderjs 技术,实现了 mathlive 在 H5 端和 App 端的无缝运行:

  • H5 端:使用本地静态资源加载 mathlive,提升加载速度和离线可用性。
  • App 端:通过 CDN 加载 mathlive,保证资源的最新性和兼容性。

主要功能

  • 数学公式编辑与展示
  • 虚拟键盘支持
  • 适配多端(H5/App)

组件使用说明

MathEditor 组件 Props

Prop 类型 默认值 说明
value String '' 编辑器初始公式内容
editorId String 必填 编辑器容器唯一标识
layouts Array ['default'] 虚拟键盘布局配置
cdnUrl String 'https://unpkg.com/mathlive' App 端 mathlive CDN 地址

事件

  • input:公式内容变更时触发,参数为最新公式字符串。

使用示例

<template>
    <MathEditor
        :value="latex"
        editorId="math-editor-1"
        :layouts="['default', 'numeric']"
        :cdnUrl="'https://unpkg.com/mathlive'"
        @input="onFormulaChange"
    />
</template>

<script>
import MathEditor from '@/components/MathEditor.vue'

export default {
    components: { MathEditor },
    data() {
        return {
            latex: ''
        }
    },
    methods: {
        onFormulaChange(newValue) {
            this.latex = newValue
            // 处理公式内容变更逻辑
        }
    }
}
</script>

本地静态资源操作说明

  • mathlive 资源包可通过 npm 安装(npm install mathlive),将 node_modules/mathlive 下的相关文件(如 js、css、fonts、sounds 等)复制到项目的 static/mathlive 目录下。
  • 组件使用了 static/mathlive 目录下的资源。

目录结构简述

  • components/mathlive-app/mathlive-app.vue:核心数学公式编辑器组件
  • static/mathlive/:H5 端 mathlive 静态资源
  • pages/:页面入口

适配说明

  • H5 端自动加载本地 mathlive 资源,无需配置 CDN。
  • App 端通过 cdnUrl 指定 mathlive CDN 地址。

参考

隐私、权限声明

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

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

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

许可协议

Copyright (c) 2017 - present Arno Gourdol. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

暂无用户评论。