first add files
This commit is contained in:
86
ProjectLiaisonForm/pages/message/base/index.js
Normal file
86
ProjectLiaisonForm/pages/message/base/index.js
Normal file
@@ -0,0 +1,86 @@
|
||||
import Message from 'tdesign-miniprogram/message/index';
|
||||
|
||||
Component({
|
||||
data: {
|
||||
visible: false,
|
||||
},
|
||||
methods: {
|
||||
showTextMessage() {
|
||||
Message.info({
|
||||
context: this,
|
||||
offset: [90, 32],
|
||||
duration: 5000,
|
||||
icon: false,
|
||||
// single: false, // 打开注释体验多个消息叠加效果
|
||||
content: '这是一条纯文字的消息通知 5s消失',
|
||||
});
|
||||
},
|
||||
|
||||
showIconMessage() {
|
||||
Message.info({
|
||||
context: this,
|
||||
offset: ['180rpx', '32rpx'],
|
||||
duration: 5000,
|
||||
content: '这是一条带图标的消息通知 5s消失',
|
||||
});
|
||||
},
|
||||
|
||||
showCloseMessage() {
|
||||
Message.info({
|
||||
context: this,
|
||||
offset: ['180rpx', 32],
|
||||
content: '这是一条带关闭的消息通知',
|
||||
duration: -1,
|
||||
link: {
|
||||
content: '按钮',
|
||||
navigatorProps: {
|
||||
url: '/page/xxx/xxx',
|
||||
},
|
||||
},
|
||||
closeBtn: true,
|
||||
});
|
||||
},
|
||||
|
||||
showScrollMessage() {
|
||||
Message.info({
|
||||
context: this,
|
||||
offset: [90, 32],
|
||||
marquee: { speed: 50, loop: -1, delay: 5000 },
|
||||
icon: false,
|
||||
content: '这是一条滚动的通知信息',
|
||||
duration: -1,
|
||||
});
|
||||
},
|
||||
|
||||
showBtnMessage() {
|
||||
Message.info({
|
||||
context: this,
|
||||
offset: [90, 32],
|
||||
icon: 'notification-filled',
|
||||
content: '这是一条带操作的消息通知',
|
||||
duration: -1,
|
||||
link: {
|
||||
content: '链接',
|
||||
navigatorProps: {
|
||||
url: '/page/xxx/xxx',
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
showSingleMessage() {
|
||||
Message.info({
|
||||
context: this,
|
||||
offset: [90, 32],
|
||||
duration: 5000,
|
||||
icon: false,
|
||||
content: '这是一条纯文字的消息通知且仅显示一条',
|
||||
single: true,
|
||||
});
|
||||
},
|
||||
showComponent() {
|
||||
this.setData({
|
||||
visible: true,
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
7
ProjectLiaisonForm/pages/message/base/index.json
Normal file
7
ProjectLiaisonForm/pages/message/base/index.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"t-button": "tdesign-miniprogram/button/button",
|
||||
"t-message": "tdesign-miniprogram/message/message"
|
||||
}
|
||||
}
|
||||
29
ProjectLiaisonForm/pages/message/base/index.wxml
Normal file
29
ProjectLiaisonForm/pages/message/base/index.wxml
Normal file
@@ -0,0 +1,29 @@
|
||||
<t-message id="t-message" />
|
||||
|
||||
<t-message visible="{{visible}}" offset="{{[90, 32]}}" content="这是一条通过组件调用的消息通知" />
|
||||
|
||||
<view class="message-example">
|
||||
<t-button t-class="external-class" theme="primary" variant="outline" size="large" block bind:tap="showTextMessage"
|
||||
>纯文字的通知</t-button
|
||||
>
|
||||
|
||||
<t-button t-class="external-class" theme="primary" variant="outline" size="large" block bind:tap="showIconMessage"
|
||||
>带图标的通知</t-button
|
||||
>
|
||||
|
||||
<t-button t-class="external-class" theme="primary" variant="outline" size="large" block bind:tap="showCloseMessage"
|
||||
>带关闭的通知</t-button
|
||||
>
|
||||
|
||||
<t-button t-class="external-class" theme="primary" variant="outline" size="large" block bind:tap="showScrollMessage"
|
||||
>可滚动多通知</t-button
|
||||
>
|
||||
|
||||
<t-button t-class="external-class" theme="primary" variant="outline" size="large" block bind:tap="showBtnMessage"
|
||||
>带按钮的通知</t-button
|
||||
>
|
||||
|
||||
<t-button t-class="external-class" theme="primary" variant="outline" size="large" block bind:tap="showComponent"
|
||||
>组件调用</t-button
|
||||
>
|
||||
</view>
|
||||
7
ProjectLiaisonForm/pages/message/base/index.wxss
Normal file
7
ProjectLiaisonForm/pages/message/base/index.wxss
Normal file
@@ -0,0 +1,7 @@
|
||||
.message-example {
|
||||
margin: 32rpx;
|
||||
}
|
||||
|
||||
.external-class {
|
||||
margin: 0 0 32rpx 0;
|
||||
}
|
||||
Reference in New Issue
Block a user