mirror of
https://gitee.com/TSpecific/tuniao-ui.git
synced 2026-03-07 08:14:01 +08:00
177 lines
6.6 KiB
Vue
177 lines
6.6 KiB
Vue
<template>
|
|
<view class="basic-utils__message tn-safe-area-inset-bottom">
|
|
|
|
<!-- 顶部自定义导航 -->
|
|
<tn-nav-bar fixed>Message工具</tn-nav-bar>
|
|
|
|
<!-- 页面内容 -->
|
|
<view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
|
|
|
|
<demo-title title="uni内置toast框">
|
|
<tn-list-view backgroundColor="tn-bg-white">
|
|
<tn-list-cell>
|
|
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
|
|
<view>默认toast框</view>
|
|
<view><tn-button backgroundColor="#01BEFF" fontColor="#FFFFFF" size="sm" @click="openToast_1">弹出</tn-button></view>
|
|
</view>
|
|
</tn-list-cell>
|
|
<tn-list-cell>
|
|
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
|
|
<view>带图标 toast框</view>
|
|
<view><tn-button backgroundColor="#01BEFF" fontColor="#FFFFFF" size="sm" @click="openToast_2">弹出</tn-button></view>
|
|
</view>
|
|
</tn-list-cell>
|
|
<tn-list-cell>
|
|
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
|
|
<view>带透明mask toast框</view>
|
|
<view><tn-button backgroundColor="#01BEFF" fontColor="#FFFFFF" size="sm" @click="openToast_3">弹出</tn-button></view>
|
|
</view>
|
|
</tn-list-cell>
|
|
<tn-list-cell>
|
|
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
|
|
<view>设置时间 toast框</view>
|
|
<view><tn-button backgroundColor="#01BEFF" fontColor="#FFFFFF" size="sm" @click="openToast_4">弹出</tn-button></view>
|
|
</view>
|
|
</tn-list-cell>
|
|
<tn-list-cell>
|
|
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
|
|
<view>设置回调 toast框</view>
|
|
<view><tn-button backgroundColor="#01BEFF" fontColor="#FFFFFF" size="sm" @click="openToast_5">弹出</tn-button></view>
|
|
</view>
|
|
</tn-list-cell>
|
|
<tn-list-cell>
|
|
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
|
|
<view>关闭 toast框</view>
|
|
<view><tn-button backgroundColor="#01BEFF" fontColor="#FFFFFF" size="sm" @click="closeToast">关闭</tn-button></view>
|
|
</view>
|
|
</tn-list-cell>
|
|
</tn-list-view>
|
|
</demo-title>
|
|
|
|
<demo-title title="uni内置loading框">
|
|
<tn-list-view backgroundColor="tn-bg-white">
|
|
<tn-list-cell>
|
|
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
|
|
<view>弹出loading框</view>
|
|
<view><tn-button backgroundColor="#01BEFF" fontColor="#FFFFFF" size="sm" @click="openLoading">弹出</tn-button></view>
|
|
</view>
|
|
</tn-list-cell>
|
|
<tn-list-cell>
|
|
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
|
|
<view>关闭loading框</view>
|
|
<view><tn-button backgroundColor="#01BEFF" fontColor="#FFFFFF" size="sm" @click="closeLoading">关闭</tn-button></view>
|
|
</view>
|
|
</tn-list-cell>
|
|
</tn-list-view>
|
|
</demo-title>
|
|
|
|
<demo-title title="uni内置modal框">
|
|
<tn-list-view backgroundColor="tn-bg-white">
|
|
<tn-list-cell>
|
|
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
|
|
<view>默认modal框</view>
|
|
<view><tn-button backgroundColor="#01BEFF" fontColor="#FFFFFF" size="sm" @click="openModal_1">弹出</tn-button></view>
|
|
</view>
|
|
</tn-list-cell>
|
|
<tn-list-cell>
|
|
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
|
|
<view>隐藏取消按钮 modal框</view>
|
|
<view><tn-button backgroundColor="#01BEFF" fontColor="#FFFFFF" size="sm" @click="openModal_2">弹出</tn-button></view>
|
|
</view>
|
|
</tn-list-cell>
|
|
<tn-list-cell>
|
|
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
|
|
<view>修改文字 modal框</view>
|
|
<view><tn-button backgroundColor="#01BEFF" fontColor="#FFFFFF" size="sm" @click="openModal_3">弹出</tn-button></view>
|
|
</view>
|
|
</tn-list-cell>
|
|
</tn-list-view>
|
|
</demo-title>
|
|
|
|
<view class="tn-padding-bottom-lg"></view>
|
|
</view>
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import demoTitle from '@/libs/components/demo-title.vue'
|
|
export default {
|
|
name: 'basicUtilsMessage',
|
|
components: {demoTitle},
|
|
data() {
|
|
return {
|
|
|
|
}
|
|
},
|
|
methods: {
|
|
// 弹出toast
|
|
openToast_1() {
|
|
this.$t.message.toast('弹出toast')
|
|
},
|
|
openToast_2() {
|
|
this.$t.message.toast('弹出toast icon', false, null, 'success')
|
|
},
|
|
openToast_3() {
|
|
this.$t.message.toast('弹出toast mask', true)
|
|
},
|
|
openToast_4() {
|
|
this.$t.message.toast('弹出toast duration', false, null, 'none', 3000)
|
|
},
|
|
openToast_5() {
|
|
this.$t.message.toast('弹出toast cb', true, () => {
|
|
setTimeout(() => {
|
|
this.$t.message.toast('执行完毕后弹出', true, null, 'success')
|
|
}, 500)
|
|
})
|
|
},
|
|
// 关闭Toast
|
|
closeToast() {
|
|
this.$t.message.closeToast()
|
|
},
|
|
|
|
|
|
// 弹出loading
|
|
openLoading() {
|
|
this.$t.message.loading('弹出loading')
|
|
setTimeout(() => {
|
|
this.closeLoading()
|
|
}, 3000)
|
|
},
|
|
// 关闭loading
|
|
closeLoading() {
|
|
this.$t.message.closeLoading()
|
|
},
|
|
|
|
|
|
// 弹出modal
|
|
openModal_1() {
|
|
this.$t.message.modal("提示", "请进行登录后进行操作", () => {
|
|
this.$t.message.toast('点击了确认按钮')
|
|
}, true, () => {
|
|
this.$t.message.toast('点击了取消按钮')
|
|
})
|
|
},
|
|
openModal_2() {
|
|
this.$t.message.modal("提示", "请进行登录后进行操作", () => {
|
|
this.$t.message.toast('点击了确认按钮')
|
|
}, false, null)
|
|
},
|
|
openModal_3() {
|
|
this.$t.message.modal("提示", "请进行登录后进行操作", () => {
|
|
this.$t.message.toast('点击了跳转按钮')
|
|
}, true, () => {
|
|
this.$t.message.toast('点击了拒绝按钮')
|
|
}, "跳转登录", "拒绝登录")
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.basic-utils__message {
|
|
background-color: $tn-bg-gray-color;
|
|
min-height: 100vh;
|
|
}
|
|
</style>
|