Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: 基础组件文档 #1785

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

doc: 基础组件文档 #1785

wants to merge 14 commits into from

Conversation

yandadaFreedom
Copy link
Collaborator

No description provided.

@yandadaFreedom yandadaFreedom changed the title doc: 基础组件文档(更新中) doc: 基础组件文档 Jan 7, 2025
@@ -25,16 +25,944 @@

### 模版语法

#### 事件处理
目前 Mpx 输出 React Native 的事件编写遵循小程序的事件编写规范,支持事件的冒泡及捕获
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mpx 基础 - 事件处理章节可以进行一下更详细的描述补充

### 基础组件
目前 Mpx 输出 React Native 仅支持以下组件,文档中未提及的组件以及组件属性即为不支持,具体使用范围可参考如下文档

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以补充一下支持透传 RN 特有属性 & 特有属性在跨平台时输出小程序、web时不生效


| 事件名 | 说明 |
| ----------------| --------------------------------------------------- |
| bindtap | 点击的时候触发 |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

通用事件无需额外添加

| 属性名 | 类型 | 默认值 | 说明 |
| ----------------------- | ------- | ------------- | ---------------------------------------------------------- |
| user-select | boolean | `false` | 文本是否可选。 |
| disable-default-style | boolean | `false` | 会内置默认样式,比如fontSize为16。设置`true`可以禁止默认的内置样式。 |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RN 特有的属性可以加一下说明


| 事件名 | 说明 |
| ----------------| --------------------------------------------------- |
| bindtap | 点击的时候触发 |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

通用事件可以不用单独说明


| 属性名 | 类型 | 默认值 | 说明 |
| ----------------------- | ------- | ------------- | --------------------------------------------------------- |
| size | String | `default` | 按钮的大小 |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

值有哪些可以列一下

| 属性名 | 类型 | 默认值 | 说明 |
| ----------------------- | ------- | ------------- | --------------------------------------------------------- |
| size | String | `default` | 按钮的大小 |
| type | String | `default` | 按钮的样式类型 |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

值有哪些可以列一下

| 属性名 | 类型 | 默认值 | 说明 |
| ----------------------- | ------- | ------------- | ---------------------------------------------------------- |
| value | String | | 输入框的初始内容 |
| type | String | `text` | input 的类型,不支持 `safe-password`、`nickname` |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type 有哪些枚举可以列一下

| maxlength | Number | `140` | 最大输入长度,设置为 -1 的时候不限制最大长度 |
| auto-focus | Boolean | `false` | (即将废弃,请直接使用 focus )自动聚焦,拉起键盘 |
| focus | Boolean | `false` | 获取焦点 |
| confirm-type | String | `done` | 设置键盘右下角按钮的文字,仅在 type='text' 时生效 |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirm-type 有哪些类型也可以枚举一下

| auto-focus | Boolean | `false` | (即将废弃,请直接使用 focus )自动聚焦,拉起键盘 |
| focus | Boolean | `false` | 获取焦点 |
| auto-height | Boolean | `false` | 是否自动增高,设置 auto-height 时,style.height不生效 |
| confirm-type | String | `done` | 设置键盘右下角按钮的文字,不支持 `return` |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirm-type 列一下枚举值

| 属性名 | 类型 | 默认值 | 说明 |
| ----------------------- | ------- | ------------- | ---------------------------------------------------------- |
| src | String | `false` | 图片资源地址及 base64 格式数据 |
| mode | String | `scaleToFill` | 图片裁剪、缩放的模式,适配微信 image 所有 mode 格式 |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mode 枚举值可以列一下




#### canvas
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

canvas 的使用文档是否有?看下是否可以在Mpx内补充或者外链出去

```javascript
// 全量引入api-proxy
import mpx from '@mpxjs/core'
import apiProxy from '@didi/mpxjs-api-proxy'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要使用内源版本

```
需要在mpx项目中需要配置externals
```
externals: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

externals 可以给出详细的 vue.config.js 的配置方式,或者说明下需要在 webpack 中配置也行

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个地方好像也不需要吧,脚手架生成的Mpx项目中自动带上不就行了


### 应用能力
##### invoke示例代码
对于业务中一些特殊的方法,需要有web与RN进行交互的这种情况,基于这种情况在mpx框架内部提供了挂在方法的能力,在webview-bridge提供了invoke通信的能力,具体使用方法如下:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"基于这种情况在mpx框架内部提供了挂在方法的能力"

有个错别字

@WX-DongXing WX-DongXing force-pushed the feat-rn-components-doc branch from d443ef4 to 1c36b79 Compare January 9, 2025 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants