提交 a3822e02 编写于 作者: study夏羽's avatar study夏羽

update mp-baidu editor

上级 65c8b090
...@@ -2,13 +2,78 @@ ...@@ -2,13 +2,78 @@
editor 组件对应的 editorContext 实例,可通过 [uni.createSelectorQuery](/api/ui/nodes-info?id=createselectorquery) 获取。 editor 组件对应的 editorContext 实例,可通过 [uni.createSelectorQuery](/api/ui/nodes-info?id=createselectorquery) 获取。
```js
onEditorReady() {
uni.createSelectorQuery().select('#editor').context((res) => {
this.editorCtx = res.context
}).exec()
}
```
百度小程序 ```Editor``` 富文本编辑器动态库提供了 ```createEditorContext``` 的方法来获取。
```js
onEditorReady() {
this.editorCtx = requireDynamicLib('editorLib').createEditorContext('editorId');
}
```
`editorContext` 通过 `id` 跟一个 [`<editor>`](/component/editor) 组件绑定,操作对应的 [`<editor>`](/component/editor) 组件。 `editorContext` 通过 `id` 跟一个 [`<editor>`](/component/editor) 组件绑定,操作对应的 [`<editor>`](/component/editor) 组件。
**平台差异说明** **平台差异说明**
|App|H5|微信小程序|支付宝小程序|百度小程序|字节跳动小程序|QQ小程序| |App|H5 |微信小程序 |支付宝小程序 |百度小程序 |字节跳动小程序 |QQ小程序 |
|:-:|:-:|:-:|:-:|:-:|:-:|:-:| |:-:|:-: |:-: |:-: |:-: |:-: |:-: |
|√|2.4.5+|√|x|x|x|x| |√ |2.4.5+ |√ |x |需引入动态库 |x |x |
**百度小程序引入动态库**
1. 在项目中引用动态库,在 ```manifest.json``` 中增添一项 ```dynamicLib```
```js
"mp-baidu" : {
"usingComponents" : true,
"appid" : "",
"setting" : {
"urlCheck" : true
},
"dynamicLib": {//引入百度小程序动态库
"editorLib": {
"provider": "swan-editor"
}
}
},
```
2. 在每个使用到富文本编辑器组件的页面,配置 ```pages.json``` 文件如下:
``` js
{
"pages": [
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "uni-app",
"usingSwanComponents": {
"editor": "dynamicLib://editorLib/editor"
}
}
}
]
}
```
## editorContext.format(name, value) ## editorContext.format(name, value)
......
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
**平台差异说明** **平台差异说明**
|App|H5|微信小程序|支付宝小程序|百度小程序|字节跳动小程序|QQ小程序|快应用|360小程序| |App |H5 |微信小程序 |支付宝小程序|百度小程序 |字节跳动小程序|QQ小程序 |快应用 |360小程序|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:| |:-: |:-: |:-: |:-: |:-: |:-: |:-: |:-: |:-: |
|2.0+,app-vue|2.4.5+|基础库 2.7.0+|x|x|x|x| |2.0+,app-vue|2.4.5+ |基础库 2.7.0+|x |需引入动态库[引入方式](/api/media/editor-context) |x |x |x |x |
editor组件目前只有H5、App的vue页面和微信支持,其他端平台自身未提供editor组件,只能使用web-view加载web页面,也可搜索[插件市场](https://ext.dcloud.net.cn/search?q=%E5%AF%8C%E6%96%87%E6%9C%AC%E7%BC%96%E8%BE%91) 获取简单的markdown富文本编辑器 editor组件目前只有H5、App的vue页面、微信小程序、百度小程序支持,其他端平台自身未提供editor组件,只能使用web-view加载web页面,也可搜索[插件市场](https://ext.dcloud.net.cn/search?q=%E5%AF%8C%E6%96%87%E6%9C%AC%E7%BC%96%E8%BE%91) 获取简单的markdown富文本编辑器
| 属性 | 类型 | 默认值 | 必填 | 说明 | | 属性 | 类型 | 默认值 | 必填 | 说明 |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
...@@ -83,10 +83,16 @@ editor组件目前只有H5、App的vue页面和微信支持,其他端平台自 ...@@ -83,10 +83,16 @@ editor组件目前只有H5、App的vue页面和微信支持,其他端平台自
} }
}, },
methods: { methods: {
onEditorReady() { onEditorReady() {
uni.createSelectorQuery().select('#editor').context((res) => { // #ifdef MP-BAIDU
this.editorCtx = res.context this.editorCtx = requireDynamicLib('editorLib').createEditorContext('editorId');
}).exec() // #endif
// #ifdef APP-PLUS || H5 ||MP-WEIXIN
uni.createSelectorQuery().select('#editor').context((res) => {
this.editorCtx = res.context
}).exec()
// #endif
}, },
undo() { undo() {
this.editorCtx.undo() this.editorCtx.undo()
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
### scrollToElement ### scrollToElement<div id="scrollToElement"></div>
让页面滚动到 ref 对应的组件,这个 API 只能用于可滚动组件的子节点,例如 ```<scroller>``````<list>```, ```<waterfall>``` 等可滚动组件中。 让页面滚动到 ref 对应的组件,这个 API 只能用于可滚动组件的子节点,例如 ```<scroller>``````<list>```, ```<waterfall>``` 等可滚动组件中。
...@@ -204,7 +204,7 @@ ...@@ -204,7 +204,7 @@
## animation ## animation<div id="animation"></div>
```animation```模块可以用来在组件上执行动画。JS-Animation可以对组件执行一系列简单的变换 (位置、大小、旋转角度、背景颜色和不透明度)。 ```animation```模块可以用来在组件上执行动画。JS-Animation可以对组件执行一系列简单的变换 (位置、大小、旋转角度、背景颜色和不透明度)。
...@@ -309,12 +309,6 @@ ...@@ -309,12 +309,6 @@
## nvue 里使用 BindingX ## nvue 里使用 BindingX
```uni-app```是逻辑层和视图层分离的。此时会产生两层通信成本。比如拖动视图层的元素,如果在逻辑层不停接收事件,因为通信损耗会产生不顺滑的体验。 ```uni-app```是逻辑层和视图层分离的。此时会产生两层通信成本。比如拖动视图层的元素,如果在逻辑层不停接收事件,因为通信损耗会产生不顺滑的体验。
...@@ -709,16 +703,16 @@ nvue 支持大部分 uni-app API ,下面只列举目前还**不支持的 API** ...@@ -709,16 +703,16 @@ nvue 支持大部分 uni-app API ,下面只列举目前还**不支持的 API**
##### 动画 ##### 动画
|API |说明 | |API |说明 |解决方案|
|-- |-- | |-- |-- |-- |
|uni.createAnimation() |创建一个动画实例 | |uni.createAnimation() |创建一个动画实例 |[animation](#animation)|
##### 滚动 ##### 滚动
|API |说明 | |API |说明 |解决方案|
|-- |-- | |-- |-- |-- |
|uni.pageScrollTo() |将页面滚动到目标位置 | |uni.pageScrollTo() |将页面滚动到目标位置 |[scrollToElement](#scrollToElement)|
##### 节点布局交互 ##### 节点布局交互
......
```Weex``` 提供了通过事件触发动作的能力,例如在用户点击组件时执行 ```JavaScript```。
下面列出了可被添加到 ```Weex``` 组件上以定义事件动作的属性:
Weex 提供了通过事件触发动作的能力,例如在用户点击组件时执行 JavaScript。
下面列出了可被添加到 Weex 组件上以定义事件动作的属性:
### 事件穿透 ### 事件穿透
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册