-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #704 from AntzyMo/docs/dialog
Docs/dialog
- Loading branch information
Showing
19 changed files
with
356 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Component({ | ||
data: { | ||
dialogKey: '', | ||
showText: false, | ||
showMultiText: false, | ||
showTextAndTitle: false, | ||
showMultiTextAndTitle: false, | ||
}, | ||
methods: { | ||
showDialog(e) { | ||
const { key } = e.currentTarget.dataset; | ||
this.setData({ [key]: true, dialogKey: key }); | ||
}, | ||
|
||
closeDialog() { | ||
const { dialogKey } = this.data; | ||
this.setData({ [dialogKey]: false }); | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"component": true, | ||
"usingComponents": { | ||
"t-button": "tdesign-miniprogram/button/button", | ||
"t-dialog": "tdesign-miniprogram/dialog/dialog" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<view class="box"> | ||
<t-button t-class="external-class" size="large" variant="outline" data-key="showText" bind:tap="showDialog" block | ||
>单行标题</t-button | ||
> | ||
<t-dialog visible="{{showText}}" title="对话框标题" confirm-btn="我知道了" bind:confirm="closeDialog" /> | ||
|
||
<t-button t-class="external-class" size="large" variant="outline" data-key="showMultiText" bind:tap="showDialog" block | ||
>多行标题最大高度</t-button | ||
> | ||
<t-dialog | ||
visible="{{showMultiText}}" | ||
title="对话框标题告知当前状态、信息和解决方法,等内容。描述文案尽可能控制在三行内" | ||
confirm-btn="我知道了" | ||
bind:confirm="closeDialog" | ||
/> | ||
|
||
<t-button | ||
t-class="external-class" | ||
size="large" | ||
variant="outline" | ||
data-key="showTextAndTitle" | ||
bind:tap="showDialog" | ||
block | ||
>带说明文本</t-button | ||
> | ||
<t-dialog | ||
visible="{{showTextAndTitle}}" | ||
title="对话框标题" | ||
content="告知当前状态、信息和解决方法,等内容。描述文案尽可能控制在三行内" | ||
confirm-btn="我知道了" | ||
bind:confirm="closeDialog" | ||
/> | ||
|
||
<t-button | ||
t-class="external-class" | ||
size="large" | ||
variant="outline" | ||
data-key="showMultiTextAndTitle" | ||
bind:tap="showDialog" | ||
block | ||
>带说明文本最大高度</t-button | ||
> | ||
<t-dialog | ||
visible="{{showMultiTextAndTitle}}" | ||
title="对话框带文本最大高度" | ||
confirm-btn="我知道了" | ||
bind:confirm="closeDialog" | ||
> | ||
<scroll-view slot="content" scroll-y class="long-content"> | ||
<view class="content-cintainer"> | ||
告知当前状态、信息和解决方法,等内容。描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案很多描述文案 | ||
</view> | ||
</scroll-view> | ||
</t-dialog> | ||
</view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
.box { | ||
margin: 32rpx; | ||
} | ||
|
||
.external-class { | ||
margin: 0 0 32rpx 0; | ||
height: 96rpx; | ||
} | ||
|
||
.long-content { | ||
height: 576rpx; | ||
margin-top: 16rpx; | ||
font-size: 32rpx; | ||
color: #888; | ||
} | ||
.long-content .content-cintainer { | ||
width: 540rpx; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Dialog from 'tdesign-miniprogram/dialog/index'; | ||
|
||
Component({ | ||
methods: { | ||
showDialog(e) { | ||
const { type } = e.currentTarget.dataset; | ||
|
||
const dialogConfig = { | ||
context: this, | ||
title: '弹窗标题', | ||
content: '告知当前状态、信息和解决方法等内容。', | ||
confirmBtn: '确认按钮', | ||
}; | ||
|
||
if (type === 'hasCancelBtn') { | ||
dialogConfig.cancelBtn = '取消按钮'; | ||
} | ||
|
||
Dialog.confirm(dialogConfig); | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"component": true, | ||
"usingComponents": { | ||
"t-button": "tdesign-miniprogram/button/button", | ||
"t-dialog": "tdesign-miniprogram/dialog/dialog" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<view class="box"> | ||
<t-button t-class="external-class" size="large" variant="outline" data-type="hasCancelBtn" bind:tap="showDialog" block | ||
>带取消按钮</t-button | ||
> | ||
<t-button t-class="external-class" size="large" variant="outline" bind:tap="showDialog" block>无取消按钮</t-button> | ||
<t-dialog id="t-dialog" /> | ||
</view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.box { | ||
margin: 32rpx; | ||
} | ||
|
||
.external-class { | ||
margin: 0 0 32rpx 0; | ||
height: 96rpx; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Component({ | ||
data: { | ||
dialogKey: '', | ||
showConfirm: false, | ||
showWarnConfirm: false, | ||
showTooLongBtnContent: false, | ||
showMultiBtn: false, | ||
multiBtnList: [ | ||
{ name: '取消', primary: false }, | ||
{ name: '单行按钮最多十五个字符文案内容', primary: true }, | ||
{ name: '按钮文案文字内容较长', primary: true, style: 'color:red;' }, | ||
], | ||
}, | ||
methods: { | ||
showDialog(e) { | ||
const { key } = e.currentTarget.dataset; | ||
this.setData({ [key]: true, dialogKey: key }); | ||
}, | ||
|
||
closeDialog() { | ||
const { dialogKey } = this.data; | ||
this.setData({ [dialogKey]: false }); | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"component": true, | ||
"usingComponents": { | ||
"t-button": "tdesign-miniprogram/button/button", | ||
"t-dialog": "tdesign-miniprogram/dialog/dialog" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<view class="box"> | ||
<t-button t-class="external-class" size="large" variant="outline" data-key="showConfirm" bind:tap="showDialog" block | ||
>双按钮</t-button | ||
> | ||
<t-dialog | ||
visible="{{showConfirm}}" | ||
title="对话框标题" | ||
content="告知当前状态、信息和解决方法,等内容。描述文案尽可能控制在三行内" | ||
confirm-btn="按钮最多字数" | ||
cancel-btn="取消" | ||
bind:confirm="closeDialog" | ||
bind:cancel="closeDialog" | ||
/> | ||
|
||
<t-button | ||
t-class="external-class" | ||
size="large" | ||
variant="outline" | ||
data-key="showWarnConfirm" | ||
bind:tap="showDialog" | ||
block | ||
>带警示按钮</t-button | ||
> | ||
<t-dialog | ||
visible="{{showWarnConfirm}}" | ||
title="对话框标题" | ||
t-class-confirm="custom-confirm-btn" | ||
confirm-btn="警示操作" | ||
cancel-btn="取消" | ||
bind:confirm="closeDialog" | ||
bind:cancel="closeDialog" | ||
/> | ||
|
||
<t-button | ||
t-class="external-class" | ||
size="large" | ||
variant="outline" | ||
data-key="showTooLongBtnContent" | ||
bind:tap="showDialog" | ||
block | ||
>双按钮文字过长</t-button | ||
> | ||
<t-dialog | ||
visible="{{showTooLongBtnContent}}" | ||
title="对话框标题" | ||
content="告知当前状态、信息和解决方法,等内容。描述文案尽可能控制在三行内" | ||
confirm-btn="按钮文案文字内容较长" | ||
cancel-btn="取消" | ||
button-layout="vertical" | ||
bind:confirm="closeDialog" | ||
bind:cancel="closeDialog" | ||
/> | ||
|
||
<t-button t-class="external-class" size="large" variant="outline" data-key="showMultiBtn" bind:tap="showDialog" block | ||
>多按钮</t-button | ||
> | ||
<t-dialog | ||
visible="{{showMultiBtn}}" | ||
title="对话框标题" | ||
content="告知当前状态、信息和解决方法,等内容。描述文案尽可能控制在三行内" | ||
button-layout="vertical" | ||
actions="{{ multiBtnList }}" | ||
bind:action="closeDialog" | ||
/> | ||
</view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.box { | ||
margin: 32rpx; | ||
} | ||
|
||
.external-class { | ||
margin: 0 0 32rpx 0; | ||
height: 96rpx; | ||
} | ||
|
||
.custom-confirm-btn { | ||
color: #ff4646 !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.