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

fix(button): use correct default value #240

Merged
merged 1 commit into from
Mar 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 38 additions & 32 deletions src/button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,37 +72,43 @@ isComponent: true
```

## API

### Button Props

| 名称 | 类型 | 默认值 | 说明 | 必传 |
| -- | -- | -- | -- | -- |
| block | Boolean | false | 是否为块级元素| N |
| content | String/Slot | '' | 按钮内容 | N |
| disabled | Boolean | false | 是否禁用按钮| N |
| external-classes | Array | - | 组件类名。`['t-class', 't-class-icon']`| N |
| ghost | Boolean | false | 是否为幽灵按钮(镂空按钮)| N |
| icon | String | - | 图标名称| N |
| loading | Boolean | false | 是否显示为加载状态| N |
| shape | String | rectangle | 按钮形状,有4种:长方形/正方形/圆角长方形/圆形。可选项:rectangle/square/round/circle| N |
| size | String | medium | 组件尺寸。可选项:small/medium/large。TS 类型:`SizeEnum`| N |
| theme | String | undefined | 组件风格,依次为品牌色、危险色。可选项:default/primary/danger| N |
| type | String | - | 同小程序的 formType。可选项:submit/reset| N |
| variant | String | base | 按钮形式,基础、线框、文字。可选项:base/outline/text| N |
| open-type | String | - | 微信开放能力 [查看小程序文档](https://developers.weixin.qq.com/miniprogram/dev/component/button.html)。可选项:contact/share/getPhoneNumber/getUserInfo/launchApp/openSetting/feedback | N |
| hover-stop-propagation | Boolean | false | 指定是否阻止本节点的祖先节点出现点击态| N |
| hover-start-time | Number | 20 | 按住后多久出现点击态,单位毫秒| N |
| hover-stay-time | Number | 70 | 手指松开后点击态保留时间,单位毫秒| N |
| lang | String | en | 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。 [查看小程序文档](https://developers.weixin.qq.com/miniprogram/dev/component/button.html)。可选项:en/zh_CN/zh_TW | N |
| session-from | String | - | 会话来源,open-type=contact 时有效 | N |
| send-message-title | String | 当前标题 | 会话内消息卡片标题,open-type=contact 时有效 | N |
| send-message-path | String | 当前分享路径 | 会话内消息卡片点击跳转小程序路径,open-type=contact 时有效 | N |
| send-message-img | String | 截图 | 会话内消息卡片图片,open-type=contact 时有效 | N |
| app-parameter | String | - | 打开 APP 时,向 APP 传递的参数,open-type=launchApp 时有效 | N |
| show-message-card | Boolean | false | 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示可能要发送的小程序提示,用户点击后可以快速发送小程序消息,open-type=contact 时有效 | N |
| bindgetuserinfo | Eventhandle | - | 用户点击该按钮时,会返回获取到的用户信息,回调的 detail 数据与<a href="../api/open-api/user-info/wx.getUserInfo.html">wx.getUserInfo</a>返回的一致,open-type=getUserInfo 时有效 | N |
| bindcontact | Eventhandle | - | 客服消息回调,open-type=contact | N |
| bindgetphonenumber | Eventhandle | - | 获取用户手机号回调,open-type=getPhoneNumber 时有效 | N |
| binderror | Eventhandle | - | 当使用开放能力时,发生错误的回调,open-type=launchApp 时有效 | N |
| bindopensetting | Eventhandle | - | 在打开授权设置页后回调,open-type=openSetting 时有效 | N |
| bindlaunchapp | Eventhandle | - | 打开 APP 成功的回调,open-type=launchApp 时有效 | N |
名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
block | Boolean | false | 是否为块级元素 | N
content | String / Slot | - | 按钮内容 | N
disabled | Boolean | false | 是否禁用按钮 | N
external-classes | Array | - | 组件类名。`['t-class', 't-class-icon']` | N
ghost | Boolean | false | 是否为幽灵按钮(镂空按钮) | N
icon | String | - | 图标名称 | N
loading | Boolean | false | 是否显示为加载状态 | N
shape | String | rectangle | 按钮形状,有 4 种:长方形、正方形、圆角长方形、圆形。可选项:rectangle/square/round/circle | N
size | String | medium | 组件尺寸。可选项:small/medium/large。TS 类型:`SizeEnum` | N
theme | String | default | 组件风格,依次为品牌色、危险色。可选项:default/primary/danger | N
type | String | - | 同小程序的 formType。可选项:submit/reset | N
variant | String | base | 按钮形式,基础、线框、文字。可选项:base/outline/text | N
open-type | String | - | 微信开放能力。<br />具体释义:<br />`contact` 打开客服会话,如果用户在会话中点击消息卡片后返回小程序,可以从 bindcontact 回调中获得具体信息,<a href="https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/customer-message/customer-message.html">具体说明</a> (*小程序插件中不能使用*);<br />`share` 触发用户转发,使用前建议先阅读<a href="https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html#使用指引">使用指引</a>;<br />`getPhoneNumber` 获取用户手机号,可以从bindgetphonenumber回调中获取到用户信息,<a href="https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html">具体说明</a> (*小程序插件中不能使用*);<br />`getUserInfo` 获取用户信息,可以从bindgetuserinfo回调中获取到用户信息 (*小程序插件中不能使用*);<br />`launchApp` 打开APP,可以通过app-parameter属性设定向APP传的参数<a href="https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/launchApp.html">具体说明</a>;<br />`openSetting` 打开授权设置页;<br />`feedback` 打开“意见反馈”页面,用户可提交反馈内容并上传<a href="https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.getLogManager.html">日志</a>,开发者可以登录<a href="https://mp.weixin.qq.com/">小程序管理后台</a>后进入左侧菜单“客服反馈”页面获取到反馈内容;<br />`chooseAvatar` 获取用户头像,可以从bindchooseavatar回调中获取到头像信息。<br />[小程序官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/button.html)。可选项:contact/share/getPhoneNumber/getUserInfo/launchApp/openSetting/feedback/chooseAvatar | N
hover-stop-propagation | Boolean | false | 指定是否阻止本节点的祖先节点出现点击态 | N
hover-start-time | Number | 20 | 按住后多久出现点击态,单位毫秒 | N
hover-stay-time | Number | 70 | 手指松开后点击态保留时间,单位毫秒 | N
lang | String | en | 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。。<br />具体释义:<br />`en` 英文;<br />`zh_CN` 简体中文;<br />`zh_TW` 繁体中文。<br />[小程序官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/button.html)。可选项:en/zh_CN/zh_TW | N
session-from | String | - | 会话来源,open-type="contact"时有效 | N
send-message-title | String | 当前标题 | 会话内消息卡片标题,open-type="contact"时有效 | N
send-message-path | String | 当前分享路径 | 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效 | N
send-message-img | String | 截图 | 会话内消息卡片图片,open-type="contact"时有效 | N
app-parameter | String | - | 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 | N
show-message-card | Boolean | false | 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,open-type="contact"时有效 | N
bindgetuserinfo | Eventhandle | - | 用户点击该按钮时,会返回获取到的用户信息,回调的detail数据与<a href="https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html">wx.getUserInfo</a>返回的一致,open-type="getUserInfo"时有效 | N
bindcontact | Eventhandle | - | 客服消息回调,open-type="contact"时有效 | N
bindgetphonenumber | Eventhandle | - | 获取用户手机号回调,open-type=getPhoneNumber时有效 | N
binderror | Eventhandle | - | 当使用开放能力时,发生错误的回调,open-type=launchApp时有效 | N
bindopensetting | Eventhandle | - | 在打开授权设置页后回调,open-type=openSetting时有效 | N
bindlaunchapp | Eventhandle | - | 打开 APP 成功的回调,open-type=launchApp时有效 | N
bindchooseavatar | Eventhandle | - | 获取用户头像回调,open-type=chooseAvatar时有效 | N

### Button Events

名称 | 参数 | 描述
-- | -- | --
click | `(e: MouseEvent)` | 点击时触发
22 changes: 10 additions & 12 deletions src/button/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* updated at 2021-11-24 10:58:05
* */

import { TdButtonProps } from './type';
Expand All @@ -15,7 +14,6 @@ const props: TdButtonProps = {
/** 按钮内容 */
content: {
type: String,
value: '',
},
/** 是否禁用按钮 */
disabled: {
Expand All @@ -41,10 +39,10 @@ const props: TdButtonProps = {
type: Boolean,
value: false,
},
/** 按钮形状,有二种:方形、圆角方形 */
/** 按钮形状,有 4 种:长方形、正方形、圆角长方形、圆形 */
shape: {
type: String,
value: 'square',
value: 'rectangle',
},
/** 组件尺寸 */
size: {
Expand All @@ -54,7 +52,7 @@ const props: TdButtonProps = {
/** 组件风格,依次为品牌色、危险色 */
theme: {
type: String,
value: undefined,
value: 'default',
},
/** 同小程序的 formType */
type: {
Expand All @@ -65,7 +63,7 @@ const props: TdButtonProps = {
type: String,
value: 'base',
},
/** 微信开放能力 [查看小程序文档](https://developers.weixin.qq.com/miniprogram/dev/component/button.html) */
/** 微信开放能力。<br />具体释义:<br />`contact` 打开客服会话,如果用户在会话中点击消息卡片后返回小程序,可以从 bindcontact 回调中获得具体信息,<a href="https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/customer-message/customer-message.html">具体说明</a> (*小程序插件中不能使用*);<br />`share` 触发用户转发,使用前建议先阅读<a href="https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html#使用指引">使用指引</a>;<br />`getPhoneNumber` 获取用户手机号,可以从bindgetphonenumber回调中获取到用户信息,<a href="https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html">具体说明</a> (*小程序插件中不能使用*);<br />`getUserInfo` 获取用户信息,可以从bindgetuserinfo回调中获取到用户信息 (*小程序插件中不能使用*);<br />`launchApp` 打开APP,可以通过app-parameter属性设定向APP传的参数<a href="https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/launchApp.html">具体说明</a>;<br />`openSetting` 打开授权设置页;<br />`feedback` 打开“意见反馈”页面,用户可提交反馈内容并上传<a href="https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.getLogManager.html">日志</a>,开发者可以登录<a href="https://mp.weixin.qq.com/">小程序管理后台</a>后进入左侧菜单“客服反馈”页面获取到反馈内容;<br />`chooseAvatar` 获取用户头像,可以从bindchooseavatar回调中获取到头像信息。<br />[小程序官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/button.html) */
openType: {
type: String,
},
Expand All @@ -84,27 +82,27 @@ const props: TdButtonProps = {
type: Number,
value: 70,
},
/** 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。 [查看小程序文档](https://developers.weixin.qq.com/miniprogram/dev/component/button.html) */
/** 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。。<br />具体释义:<br />`en` 英文;<br />`zh_CN` 简体中文;<br />`zh_TW` 繁体中文。<br />[小程序官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/button.html) */
lang: {
type: String,
value: 'en',
},
/** 会话来源,open-type=contact时有效 */
/** 会话来源,open-type="contact"时有效 */
sessionFrom: {
type: String,
value: '',
},
/** 会话内消息卡片标题,open-type=contact时有效 */
/** 会话内消息卡片标题,open-type="contact"时有效 */
sendMessageTitle: {
type: String,
value: '',
},
/** 会话内消息卡片点击跳转小程序路径,open-type=contact时有效 */
/** 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效 */
sendMessagePath: {
type: String,
value: '',
},
/** 会话内消息卡片图片,open-type=contact时有效 */
/** 会话内消息卡片图片,open-type="contact"时有效 */
sendMessageImg: {
type: String,
value: '',
Expand All @@ -114,7 +112,7 @@ const props: TdButtonProps = {
type: String,
value: '',
},
/** 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示可能要发送的小程序提示,用户点击后可以快速发送小程序消息,open-type=contact时有效 */
/** 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,open-type="contact"时有效 */
showMessageCard: {
type: Boolean,
value: false,
Expand Down
Loading