first add files
This commit is contained in:
36
ProjectLiaisonForm/pages/popup/custom-close/index.js
Normal file
36
ProjectLiaisonForm/pages/popup/custom-close/index.js
Normal file
@@ -0,0 +1,36 @@
|
||||
Component({
|
||||
data: {
|
||||
cur: {},
|
||||
position: [
|
||||
{ value: 'top', text: '顶部弹出' },
|
||||
{ value: 'left', text: '左侧弹出' },
|
||||
{ value: 'center', text: '中间弹出' },
|
||||
{ value: 'bottom', text: '底部弹出' },
|
||||
{ value: 'right', text: '右侧弹出' },
|
||||
],
|
||||
},
|
||||
methods: {
|
||||
handlePopup(e) {
|
||||
const { item } = e.currentTarget.dataset;
|
||||
|
||||
this.setData(
|
||||
{
|
||||
cur: item,
|
||||
},
|
||||
() => {
|
||||
this.setData({ visible: true });
|
||||
},
|
||||
);
|
||||
},
|
||||
onVisibleChange(e) {
|
||||
this.setData({
|
||||
visible: e.detail.visible,
|
||||
});
|
||||
},
|
||||
onClose() {
|
||||
this.setData({
|
||||
visible: false,
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
8
ProjectLiaisonForm/pages/popup/custom-close/index.json
Normal file
8
ProjectLiaisonForm/pages/popup/custom-close/index.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"t-popup": "tdesign-miniprogram/popup/popup",
|
||||
"t-icon": "tdesign-miniprogram/icon/icon",
|
||||
"t-button": "tdesign-miniprogram/button/button"
|
||||
}
|
||||
}
|
||||
9
ProjectLiaisonForm/pages/popup/custom-close/index.wxml
Normal file
9
ProjectLiaisonForm/pages/popup/custom-close/index.wxml
Normal file
@@ -0,0 +1,9 @@
|
||||
<t-popup visible="{{visible}}" bind:visible-change="onVisibleChange" placement="center">
|
||||
<view class="block">
|
||||
<t-icon t-class="close-btn" name="close-circle" size="64rpx" color="#fff" bind:tap="onClose" />
|
||||
</view>
|
||||
</t-popup>
|
||||
|
||||
<t-button block size="large" variant="outline" theme="primary" bind:tap="handlePopup">
|
||||
居中弹出层-带自定义关闭按钮
|
||||
</t-button>
|
||||
14
ProjectLiaisonForm/pages/popup/custom-close/index.wxss
Normal file
14
ProjectLiaisonForm/pages/popup/custom-close/index.wxss
Normal file
@@ -0,0 +1,14 @@
|
||||
.block {
|
||||
position: relative;
|
||||
width: 240px;
|
||||
height: 240px;
|
||||
background: var(--td-bg-color-container);
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.close-btn {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
margin-left: -32rpx;
|
||||
bottom: calc(-1 * (48rpx + 64rpx));
|
||||
}
|
||||
Reference in New Issue
Block a user