Skip to content

Commit

Permalink
release v2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jin-yufeng committed Jan 8, 2021
1 parent 766c0f1 commit 542f0d3
Show file tree
Hide file tree
Showing 40 changed files with 300 additions and 184 deletions.
107 changes: 67 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,35 +71,63 @@
查看 [快速开始](https://jin-yufeng.gitee.io/mp-html/#/overview/quickstart) 了解更多

### uni-app
1. 将源码中 `dist/uni-app` 内的内容拷贝到项目根目录下
2. 在需要使用页面的 `vue` 文件中添加

```vue
<template>
<view>
<mp-html :content="html" />
</view>
</template>
<script>
import mpHtml from '@/components/mp-html/mp-html'
export default {
// HBuilderX 2.5.5+ 可以通过 easycom 自动引入
components: {
mpHtml
},
data() {
return {
html: ''
- 源码方式
1. 将源码中 `dist/uni-app` 内的内容拷贝到项目根目录下
可以直接通过 [插件市场](https://ext.dcloud.net.cn/plugin?id=805) 引入
2. 在需要使用页面的 `vue` 文件中添加

```vue
<template>
<view>
<mp-html :content="html" />
</view>
</template>
<script>
import mpHtml from '@/components/mp-html/mp-html'
export default {
// HBuilderX 2.5.5+ 可以通过 easycom 自动引入
components: {
mpHtml
},
data() {
return {
html: '<div>Hello World!</div>'
}
}
},
onLoad() {
this.html = '<div>Hello World!</div>'
}
}
</script>
```
</script>
```
- `npm` 方式
1. 在项目目录下安装组件包

可以直接通过 [插件市场](https://ext.dcloud.net.cn/plugin?id=805) 引入
```bash
npm install mp-html
```
2. 在需要使用页面的 `vue` 文件中添加

```vue
<template>
<view>
<mp-html :content="html" />
</view>
</template>
<script>
import mpHtml from 'mp-html/dist/uni-app/components/mp-html/mp-html'
export default {
// 不可省略
components: {
mpHtml
},
data() {
return {
html: '<div>Hello World!</div>'
}
}
}
</script>
```

如果在 `nvue` 中使用还要将 `dist/uni-app/static` 目录下的内容拷贝到项目的 `static` 目录下,否则无法运行

查看 [快速开始](https://jin-yufeng.gitee.io/mp-html/#/overview/quickstart) 了解更多

Expand Down Expand Up @@ -188,6 +216,19 @@
![支持](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/sponsor.png)

## 更新日志
- v2.0.2 (20210108)
1. `U` `uni-app` 包微信端利用 `virtualHost` 去除夹层,加快渲染
2. `F` 修复了部分情况下 `flex` 布局显示不正确的问题
3. `F` 修复了设置 `loading-img` 会导致懒加载失效的问题
4. `F` 修复了头条原生包部分情况下表格显示不正确的问题
5. `F` 修复了 `uni-app``h5``app` 端部分插件样式无法应用的问题
6. `F` 修复了 `uni-app` 包没有自动将 `data-src` 设置为 `src` 的问题
7. `F` 修复了 `uni-app` 包的 `nvue``getRect` 方法无法使用的问题
8. `F` 修复了 `uni-app` 包运行到华为快应用可能报错的问题
9. `F` 修复了在低版本 taro 中使用可能无法正确解析的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/248)
10. `F` 修复了 `highlight` 插件 `pre``code` 之间有空白符时无法高亮的问题
11. `F` 修复了 `editable` 插件清空内容后插入可能报错的问题

- v2.0.1 (20210101)
1. `F` 修复了 `a` 标签自动跳转到不存在页面时可能报错的问题
2. `F` 修复了含合并单元格的表格设置列宽可能导致显示不正确的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/239)
Expand All @@ -196,20 +237,6 @@
5. `F` 修复了 `uni-app``h5``app` 端可能无法使用 `iframe``embed` 标签的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/245)
6. `F` 修复了 uni-app 使用部分插件会报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/246)

- v2.0.0 (20201226)
1. `U` 通过 `gulp` 进行构建,自动生成各平台压缩版代码,减小引入包大小 [详细](https://jin-yufeng.gitee.io/mp-html/#/advanced/develop#pack)
2. `U` 没有设置 `href` 属性的 `a` 标签不应用链接的样式,可以用作一般标签的点击处理 [详细](https://jin-yufeng.gitee.io/mp-html/#/question/faq#tap)
3. `U` 提供了统一的插件接口,扩展更加方便(代码高亮、`markdown` 等都可以直接通过引入插件实现)[详细](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin)
4. `U` 实现了简单的编辑功能 [详细](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#editable)
5. `U` 支持生成各平台的示例项目,便于调试 [详细](https://jin-yufeng.gitee.io/mp-html/#/overview/quickstart#demo)
6. `U` 原生包共用一份源代码(构建时进行自动转换),注释更加详细,便于了解和维护
7. `U` 通过 `jest` 进行单元测试,进一步保证代码质量 [详细](https://jin-yufeng.gitee.io/mp-html/#/advanced/develop#test)
8. `U` 去除了一些冗余功能,进一步减小包大小(约 `24.5KB`
9. `U` 减少了递归节点树,加快渲染速度
10. `U` `uni-app``app` 端使用非原生的 `video` 显示视频以解决无法同层带来的系列问题
11. `U` `uni-app``nvue` 端支持通过 `bgColor` 属性设置背景色(默认白色,不可设置为透明)
12. `F` 修复了 `uni-app``nvue` 端从不可见区域到可见时可能显示不正确的问题

`1.x` 的升级方法可见 [更新指南](https://jin-yufeng.gitee.io/mp-html/#/changelog/changelog?id=v200)

查看 [更新日志](https://jin-yufeng.gitee.io/mp-html/#/changelog/changelog) 了解更多
3 changes: 1 addition & 2 deletions dist/mp-alipay/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/mp-alipay/node/node.acss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
._a{padding:1.5px 0 1.5px 0;color:#366092;word-break:break-all}._hover{text-decoration:underline;opacity:.7}._img{max-width:100%;-webkit-touch-callout:none}._b,._strong{font-weight:700}._code{font-family:monospace}._del{text-decoration:line-through}._em,._i{font-style:italic}._h1{font-size:2em}._h2{font-size:1.5em}._h3{font-size:1.17em}._h5{font-size:.83em}._h6{font-size:.67em}._h1,._h2,._h3,._h4,._h5,._h6{display:block;font-weight:700}._ins{text-decoration:underline}._li{display:list-item}._ol{list-style-type:decimal}._ol,._ul{display:block;padding-left:40px;margin:1em 0}._q::before{content:'"'}._q::after{content:'"'}._sub{font-size:smaller;vertical-align:sub}._sup{font-size:smaller;vertical-align:super}._tbody,._tfoot,._thead{display:table-row-group}._tr{display:table-row}._td,._th{display:table-cell;vertical-align:middle}._th{font-weight:700;text-align:center}._ul{list-style-type:disc}._ul ._ul{margin:0;list-style-type:circle}._ul ._ul ._ul{list-style-type:square}._abbr,._b,._code,._del,._em,._i,._ins,._label,._q,._span,._strong,._sub,._sup{display:inline}._blockquote,._div,._p{display:block}
._a{padding:1.5px 0 1.5px 0;color:#366092;word-break:break-all}._hover{text-decoration:underline;opacity:.7}._img{max-width:100%;-webkit-touch-callout:none}._b,._strong{font-weight:700}._code{font-family:monospace}._del{text-decoration:line-through}._em,._i{font-style:italic}._h1{font-size:2em}._h2{font-size:1.5em}._h3{font-size:1.17em}._h5{font-size:.83em}._h6{font-size:.67em}._h1,._h2,._h3,._h4,._h5,._h6{display:block;font-weight:700}._ins{text-decoration:underline}._li{display:list-item}._ol{list-style-type:decimal}._ol,._ul{display:block;padding-left:40px;margin:1em 0}._q::before{content:'"'}._q::after{content:'"'}._sub{font-size:smaller;vertical-align:sub}._sup{font-size:smaller;vertical-align:super}._tbody,._tfoot,._thead{display:table-row-group}._tr{display:table-row}._td,._th{display:table-cell;vertical-align:middle}._th{font-weight:700;text-align:center}._ul{list-style-type:disc}._ul ._ul{margin:0;list-style-type:circle}._ul ._ul ._ul{list-style-type:square}._abbr,._b,._code,._del,._em,._i,._ins,._label,._q,._span,._strong,._sub,._sup{display:inline}
2 changes: 1 addition & 1 deletion dist/mp-alipay/node/node.axml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<template name="el"><block a:if="{{n.name=='img'}}"><image a:if="{{(opts[1]&&!ctrl[i])||ctrl[i]<0}}" class="_img" style="{{n.attrs.style}}" src="{{ctrl[i]<0?opts[2]:opts[1]}}" mode="widthFix"/><image a:if="{{ctrl[i]!=-1}}" id="{{n.attrs.id}}" class="_img {{n.attrs.class}}" style="{{opts[1]&&!ctrl[i]?'display:none;':''}}width:{{ctrl[i]||1}}px;height:1px;{{n.attrs.style}}" src="{{n.attrs.src}}" mode="{{n.h?'':'widthFix'}}" lazy-load="{{opts[0]}}" data-i="{{i}}" onLoad="imgLoad" onError="mediaError" onTap="imgTap" onLongTap="noop"/></block><text a:elif="{{n.type=='text'}}" decode>{{n.text}}</text><text a:elif="{{n.name=='br'}}">\n</text><view a:elif="{{n.name=='a'}}" id="{{n.attrs.id}}" class="{{n.attrs.href?'_a ':''}}{{n.attrs.class}}" hover-class="_hover" style="display:inline;{{n.attrs.style}}" data-i="{{i}}" catchTap="linkTap"><node childs="{{n.children}}" class="_n" opts="{{opts}}" style="display:inline" onAdd="add"/></view><video a:elif="{{n.name=='video'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" autoplay="{{n.attrs.autoplay}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" muted="{{n.attrs.muted}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" onPlay="play" onError="mediaError"/><audio a:elif="{{n.name=='audio'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" author="{{n.attrs.author}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" name="{{n.attrs.name}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" onPlay="play" onError="mediaError"/><rich-text a:else id="{{n.attrs.id}}" style="{{n.f}};display:inline" nodes="{{[n]}}"/></template><view id="{{id}}" class="{{className}}" style="{{style}}"><block a:for="{{childs}}" a:for-item="n1" a:for-index="i1" a:key="i1"><template a:if="{{!n1.c}}" is="el" data="{{n:n1,i:''+i1,opts:opts,ctrl:ctrl}}"/><view a:else id="{{n1.attrs.id}}" class="_{{n1.name}} {{n1.attrs.class}}" style="{{n1.attrs.style}}"><block a:for="{{n1.children}}" a:for-item="n2" a:for-index="i2" a:key="i2"><template a:if="{{!n2.c}}" is="el" data="{{n:n2,i:i1+'_'+i2,opts:opts,ctrl:ctrl}}"/><view a:else id="{{n2.attrs.id}}" class="_{{n2.name}} {{n2.attrs.class}}" style="{{n2.attrs.style}}"><block a:for="{{n2.children}}" a:for-item="n3" a:for-index="i3" a:key="i3"><template a:if="{{!n3.c}}" is="el" data="{{n:n3,i:i1+'_'+i2+'_'+i3,opts:opts,ctrl:ctrl}}"/><view a:else id="{{n3.attrs.id}}" class="_{{n3.name}} {{n3.attrs.class}}" style="{{n3.attrs.style}}"><block a:for="{{n3.children}}" a:for-item="n4" a:for-index="i4" a:key="i4"><template a:if="{{!n4.c}}" is="el" data="{{n:n4,i:i1+'_'+i2+'_'+i3+'_'+i4,opts:opts,ctrl:ctrl}}"/><view a:else id="{{n4.attrs.id}}" class="_{{n4.name}} {{n4.attrs.class}}" style="{{n4.attrs.style}}"><block a:for="{{n4.children}}" a:for-item="n5" a:for-index="i5" a:key="i5"><template a:if="{{!n5.c}}" is="el" data="{{n:n5,i:i1+'_'+i2+'_'+i3+'_'+i4+'_'+i5,opts:opts,ctrl:ctrl}}"/><node a:else id="{{n5.attrs.id}}" class="_n _{{n5.name}} {{n5.attrs.class}}" style="{{n5.attrs.style}}" childs="{{n5.children}}" opts="{{opts}}" onAdd="add"/></block></view></block></view></block></view></block></view></block></view>
<template name="el"><block a:if="{{n.name=='img'}}"><image a:if="{{(opts[1]&&!ctrl[i])||ctrl[i]<0}}" class="_img" style="{{n.attrs.style}}" src="{{ctrl[i]<0?opts[2]:opts[1]}}" mode="widthFix"/><image id="{{n.attrs.id}}" class="_img {{n.attrs.class}}" style="{{ctrl[i]==-1?'display:none;':''}}width:{{ctrl[i]||1}}px;height:1px;{{n.attrs.style}}" src="{{n.attrs.src}}" mode="{{n.h?'':'widthFix'}}" lazy-load="{{opts[0]}}" data-i="{{i}}" onLoad="imgLoad" onError="mediaError" onTap="imgTap" onLongTap="noop"/></block><text a:elif="{{n.type=='text'}}" decode>{{n.text}}</text><text a:elif="{{n.name=='br'}}">\n</text><view a:elif="{{n.name=='a'}}" id="{{n.attrs.id}}" class="{{n.attrs.href?'_a ':''}}{{n.attrs.class}}" hover-class="_hover" style="display:inline;{{n.attrs.style}}" data-i="{{i}}" catchTap="linkTap"><node childs="{{n.children}}" class="_n" opts="{{opts}}" style="display:inline" onAdd="add"/></view><video a:elif="{{n.name=='video'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" autoplay="{{n.attrs.autoplay}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" muted="{{n.attrs.muted}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" onPlay="play" onError="mediaError"/><audio a:elif="{{n.name=='audio'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" author="{{n.attrs.author}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" name="{{n.attrs.name}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" onPlay="play" onError="mediaError"/><rich-text a:else id="{{n.attrs.id}}" style="{{n.f}};display:inline" nodes="{{[n]}}"/></template><view id="{{id}}" class="{{className}}" style="{{style}}"><block a:for="{{childs}}" a:for-item="n1" a:for-index="i1" a:key="i1"><template a:if="{{!n1.c}}" is="el" data="{{n:n1,i:''+i1,opts:opts,ctrl:ctrl}}"/><view a:else id="{{n1.attrs.id}}" class="_{{n1.name}} {{n1.attrs.class}}" style="{{n1.attrs.style}}"><block a:for="{{n1.children}}" a:for-item="n2" a:for-index="i2" a:key="i2"><template a:if="{{!n2.c}}" is="el" data="{{n:n2,i:i1+'_'+i2,opts:opts,ctrl:ctrl}}"/><view a:else id="{{n2.attrs.id}}" class="_{{n2.name}} {{n2.attrs.class}}" style="{{n2.attrs.style}}"><block a:for="{{n2.children}}" a:for-item="n3" a:for-index="i3" a:key="i3"><template a:if="{{!n3.c}}" is="el" data="{{n:n3,i:i1+'_'+i2+'_'+i3,opts:opts,ctrl:ctrl}}"/><view a:else id="{{n3.attrs.id}}" class="_{{n3.name}} {{n3.attrs.class}}" style="{{n3.attrs.style}}"><block a:for="{{n3.children}}" a:for-item="n4" a:for-index="i4" a:key="i4"><template a:if="{{!n4.c}}" is="el" data="{{n:n4,i:i1+'_'+i2+'_'+i3+'_'+i4,opts:opts,ctrl:ctrl}}"/><view a:else id="{{n4.attrs.id}}" class="_{{n4.name}} {{n4.attrs.class}}" style="{{n4.attrs.style}}"><block a:for="{{n4.children}}" a:for-item="n5" a:for-index="i5" a:key="i5"><template a:if="{{!n5.c}}" is="el" data="{{n:n5,i:i1+'_'+i2+'_'+i3+'_'+i4+'_'+i5,opts:opts,ctrl:ctrl}}"/><node a:else id="{{n5.attrs.id}}" class="_n _{{n5.name}} {{n5.attrs.class}}" style="{{n5.attrs.style}}" childs="{{n5.children}}" opts="{{opts}}" onAdd="add"/></block></view></block></view></block></view></block></view></block></view>
Loading

0 comments on commit 542f0d3

Please sign in to comment.