-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 更新 modal 的 axml * fix: 修复 axml * fix: 修复 a:elif 转换的问题 * fix: 更新 modal 的 axml * feat: 更新 modal --------- Co-authored-by: DiamondYuan <fandi.yfd@antgroup.com>
- Loading branch information
1 parent
b45d034
commit 08f7a92
Showing
22 changed files
with
496 additions
and
442 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 |
---|---|---|
@@ -1,42 +1,42 @@ | ||
Page({ | ||
data: { | ||
basicVisible: false, | ||
withTitleVisible: false, | ||
basicTwoVisible: false, | ||
basicThreeVisible: false, | ||
focusOneVisible: false, | ||
focusTwoVisible: false, | ||
focusThreeVisible: false, | ||
customVisible: false, | ||
customBodyVisible: false, | ||
}, | ||
handleOpen(e) { | ||
const { field } = e.target.dataset; | ||
this.setData({ [field]: true }); | ||
}, | ||
handleClose() { | ||
this.setData({ | ||
basicVisible: false, | ||
withTitleVisible: false, | ||
basicTwoVisible: false, | ||
basicThreeVisible: false, | ||
focusOneVisible: false, | ||
focusTwoVisible: false, | ||
focusThreeVisible: false, | ||
customVisible: false, | ||
customBodyVisible: false, | ||
}); | ||
}, | ||
handlePrimaryButtonTap() { | ||
this.handleClose(); | ||
my.showToast({ content: '点击主按钮', duration: 1000 }); | ||
}, | ||
handleSecondaryButtonTap() { | ||
this.handleClose(); | ||
my.showToast({ content: '点击辅助按钮', duration: 1000 }); | ||
}, | ||
handleCancelButtonTap() { | ||
this.handleClose(); | ||
my.showToast({ content: '点击取消按钮', duration: 1000 }); | ||
}, | ||
data: { | ||
basicVisible: false, | ||
withTitleVisible: false, | ||
basicTwoVisible: false, | ||
basicThreeVisible: false, | ||
focusOneVisible: false, | ||
focusTwoVisible: false, | ||
focusThreeVisible: false, | ||
customVisible: false, | ||
customBodyVisible: false, | ||
}, | ||
handleOpen(e) { | ||
const { field } = e.target.dataset; | ||
this.setData({ [field]: true }); | ||
}, | ||
handleClose() { | ||
this.setData({ | ||
basicVisible: false, | ||
withTitleVisible: false, | ||
basicTwoVisible: false, | ||
basicThreeVisible: false, | ||
focusOneVisible: false, | ||
focusTwoVisible: false, | ||
focusThreeVisible: false, | ||
customVisible: false, | ||
customBodyVisible: false, | ||
}); | ||
}, | ||
handlePrimaryButtonTap() { | ||
this.handleClose(); | ||
my.showToast({ content: '点击主按钮', duration: 1000 }); | ||
}, | ||
handleSecondaryButtonTap() { | ||
this.handleClose(); | ||
my.showToast({ content: '点击辅助按钮', duration: 1000 }); | ||
}, | ||
handleCancelButtonTap() { | ||
this.handleClose(); | ||
my.showToast({ content: '点击取消按钮', duration: 1000 }); | ||
}, | ||
}); |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,119 +1,122 @@ | ||
<import-sjs | ||
from="./index.sjs" | ||
name="{getDirection}" /> | ||
<popup | ||
className="ant-modal {{className || ''}}" | ||
style="{{style || ''}}" | ||
maskClassName="{{maskClassName}}" | ||
maskStyle="{{maskStyle}}" | ||
visible="{{visible}}" | ||
duration="{{duration}}" | ||
name="utils" /> | ||
|
||
<ant-popup | ||
className="ant-modal {{ className || '' }}" | ||
style="{{ style || '' }}" | ||
maskClassName="{{ maskClassName }}" | ||
maskStyle="{{ maskStyle }}" | ||
visible="{{ visible }}" | ||
duration="{{ duration }}" | ||
position="center" | ||
animation="{{animation}}" | ||
zIndex="{{zIndex}}" | ||
destroyOnClose="{{destroyOnClose}}" | ||
animation="{{ animation }}" | ||
zIndex="{{ zIndex }}" | ||
destroyOnClose="{{ destroyOnClose }}" | ||
onClose="onMaskClose"> | ||
<slot slot="content"> | ||
<view | ||
class="ant-modal-body {{bodyClassName || ''}}" | ||
style="{{bodyStyle || ''}}"> | ||
<slot name="header"></slot> | ||
class="ant-modal-body {{ bodyClassName || '' }}" | ||
style="{{ bodyStyle || '' }}"> | ||
<slot name="header" /> | ||
<slot name="title"> | ||
<view | ||
class="ant-modal-body-title" | ||
a:if="{{ title }}"> | ||
{{title}} | ||
a:if="{{ title }}" | ||
class="ant-modal-body-title"> | ||
{{ title }} | ||
</view> | ||
</slot> | ||
|
||
<slot name="content"> | ||
<view | ||
class="ant-modal-body-content" | ||
a:if="{{ content }}"> | ||
{{content}} | ||
a:if="{{ content }}" | ||
class="ant-modal-body-content"> | ||
{{ content }} | ||
</view> | ||
</slot> | ||
|
||
<slot name="footer"> | ||
<view | ||
a:if="{{ type === 'focus' }}" | ||
class="ant-modal-body-footer-focus"> | ||
<button | ||
<ant-button | ||
type="primary" | ||
class="ant-modal-body-footer-focus-primary" | ||
style="{{primaryButtonStyle || ''}}" | ||
className="ant-modal-body-footer-focus-primary" | ||
style="{{ primaryButtonStyle || '' }}" | ||
onTap="onPrimaryButtonTap"> | ||
{{primaryButtonText}} | ||
</button> | ||
{{ primaryButtonText }} | ||
</ant-button> | ||
<view | ||
a:if="{{ secondaryButtonText }}" | ||
class="ant-modal-body-footer-focus-secondary" | ||
a:if="{{secondaryButtonText}}" | ||
style="{{secondaryButtonStyle || ''}}" | ||
style="{{ secondaryButtonStyle || '' }}" | ||
onTap="onSecondaryButtonTap"> | ||
{{secondaryButtonText}} | ||
{{ secondaryButtonText }} | ||
</view> | ||
<view | ||
a:if="{{ cancelButtonText }}" | ||
class="ant-modal-body-footer-focus-cancel" | ||
a:if="{{cancelButtonText}}" | ||
style="{{cancelButtonStyle || ''}}" | ||
style="{{ cancelButtonStyle || '' }}" | ||
onTap="onCancelButtonTap"> | ||
{{cancelButtonText}} | ||
{{ cancelButtonText }} | ||
</view> | ||
</view> | ||
<view | ||
a:elif="{{ getDirection(primaryButtonText,secondaryButtonText,cancelButtonText,type) === 'horizontal' }}" | ||
a:elif="{{ utils.getDirection(primaryButtonText, secondaryButtonText, cancelButtonText, type) === 'horizontal' }}" | ||
class="ant-modal-body-footer-horizontal"> | ||
<view | ||
a:if="{{ cancelButtonText }}" | ||
class="ant-modal-body-footer-horizontal-cancel" | ||
a:if="{{cancelButtonText}}" | ||
style="{{cancelButtonStyle || ''}}" | ||
style="{{ cancelButtonStyle || '' }}" | ||
onTap="onCancelButtonTap"> | ||
{{cancelButtonText}} | ||
{{ cancelButtonText }} | ||
</view> | ||
<view | ||
a:if="{{ secondaryButtonText }}" | ||
class="ant-modal-body-footer-horizontal-secondary" | ||
a:if="{{secondaryButtonText}}" | ||
style="{{secondaryButtonStyle || ''}}" | ||
style="{{ secondaryButtonStyle || '' }}" | ||
onTap="onSecondaryButtonTap"> | ||
{{secondaryButtonText}} | ||
{{ secondaryButtonText }} | ||
</view> | ||
<view | ||
a:if="{{ primaryButtonText }}" | ||
class="ant-modal-body-footer-horizontal-primary" | ||
a:if="{{primaryButtonText}}" | ||
style="{{primaryButtonStyle || ''}}" | ||
style="{{ primaryButtonStyle || '' }}" | ||
onTap="onPrimaryButtonTap"> | ||
{{primaryButtonText}} | ||
{{ primaryButtonText }} | ||
</view> | ||
</view> | ||
<view | ||
a:elif="{{ getDirection(primaryButtonText,secondaryButtonText,cancelButtonText,type) === 'vertical' }}" | ||
a:elif="{{ utils.getDirection(primaryButtonText, secondaryButtonText, cancelButtonText, type) === 'vertical' }}" | ||
class="ant-modal-body-footer-vertical"> | ||
<view | ||
a:if="{{ primaryButtonText }}" | ||
class="ant-modal-body-footer-vertical-primary" | ||
a:if="{{primaryButtonText}}" | ||
style="{{primaryButtonStyle || ''}}" | ||
style="{{ primaryButtonStyle || '' }}" | ||
onTap="onPrimaryButtonTap"> | ||
{{primaryButtonText}} | ||
{{ primaryButtonText }} | ||
</view> | ||
<view | ||
a:if="{{ secondaryButtonText }}" | ||
class="ant-modal-body-footer-vertical-secondary" | ||
a:if="{{secondaryButtonText}}" | ||
style="{{secondaryButtonStyle || ''}}" | ||
style="{{ secondaryButtonStyle || '' }}" | ||
onTap="onSecondaryButtonTap"> | ||
{{secondaryButtonText}} | ||
{{ secondaryButtonText }} | ||
</view> | ||
<view | ||
a:if="{{ cancelButtonText }}" | ||
class="ant-modal-body-footer-vertical-cancel" | ||
a:if="{{cancelButtonText}}" | ||
style="{{cancelButtonStyle || ''}}" | ||
style="{{ cancelButtonStyle || '' }}" | ||
onTap="onCancelButtonTap"> | ||
{{cancelButtonText}} | ||
{{ cancelButtonText }} | ||
</view> | ||
</view> | ||
</slot> | ||
</view> | ||
</slot> | ||
<icon | ||
a:if="{{ type==='focus' && closable }}" | ||
<ant-icon | ||
a:if="{{ type === 'focus' && closable }}" | ||
type="CloseOutline" | ||
onTap="onClose" | ||
className="ant-modal-close" /> | ||
</popup> | ||
</ant-popup> |
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"component": true, | ||
"usingComponents": { | ||
"button": "../Button/index", | ||
"icon": "../Icon/index", | ||
"popup": "../Popup/index" | ||
"ant-button": "../Button/index", | ||
"ant-icon": "../Icon/index", | ||
"ant-popup": "../Popup/index" | ||
} | ||
} |
Oops, something went wrong.