Files
FirstUI-vue/pages/component/operate/dialog/dialog.vue
2023-08-17 21:28:49 +08:00

64 lines
1.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!--本文件由FirstUI授权予新疆天衡创新研究院有限公司手机号1 8 6 14 072 549身份证尾号5A07X5专用请尊重知识产权勿私下传播违者追究法律责任-->
<template>
<view class="fui-wrap">
<view class="fui-page__hd">
<view class="fui-page__title">Dialog</view>
<view class="fui-page__desc">Dialog 对话框在浮层中显示引导用户进行相关操作</view>
</view>
<view class="fui-page__bd fui-page__spacing">
<fui-button type="gray" btn-size="medium" text="基础使用" bold :margin="['24rpx']"
@click="showDialog(1)"></fui-button>
<fui-button type="gray" btn-size="medium" text="自定义按钮" bold @click="showDialog(2)">
</fui-button>
</view>
<fui-dialog :show="show" content="弹窗内容,告知当前状态、信息和解决方法,描述文字尽量控制在三行内" maskClosable @click="onClick"
@close="onClose"></fui-dialog>
<fui-dialog :show="visible" title="我是标题" content="我是自定义的对话框!" :buttons="buttons" @click="onTap"></fui-dialog>
</view>
</template>
<script>
export default {
data() {
return {
show: false,
visible: false,
buttons: [{
text: '确定',
color: '#FF2B2B'
}]
}
},
methods: {
showDialog(type) {
if (type === 1) {
this.show = true
} else {
this.visible = true
}
},
onClick(e) {
console.log(e)
this.onClose()
},
//设置maskClosable为true时点击遮罩可关闭需要配合@close事件一起使用通过控制show来达到关闭效果
onClose(e) {
this.show = false
},
onTap(e) {
console.log(e)
this.visible = false
}
}
}
</script>
<style>
.fui-page__bd {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
</style>