123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <template>
- <uni-popup ref="dialog" type="center" :is-mask-click="closeOnClickOverlay" :safe-area='false'>
- <view class="inputDialog">
- <view class="inputDialog-head">{{title}}</view>
- <view class="inputDialog-body">
- <slot name="dialogBody"></slot>
- </view>
- <view class="inputDialog-footer">
- <view class="inputDialog-footer-btn" @tap="onCancel">{{cancelText}}</view>
- <view class="inputDialog-footer-btn inputDialog-footer-l" @tap="onConfirm">{{confirmText}}</view>
- </view>
- </view>
- </uni-popup>
- </template>
- <script>
- export default {
- name: "myDialog",
- props: {
- title: {
- type: String,
- default: ""
- },
- // 取消文案
- cancelText: {
- type: String,
- default: "取消"
- },
- // 确认文案
- confirmText: {
- type: String,
- default: "确定"
- },
- // 是否允许点击遮罩关闭modal
- closeOnClickOverlay: {
- type: Boolean,
- default: true
- },
- },
- data() {
- return {
-
- }
- },
- methods: {
- open() {
- this.$refs.dialog.open()
- },
- close() {
- this.$refs.dialog.close()
- },
- onCancel() {
- this.$emit("cancel")
- },
- onConfirm(val) {
- this.$emit("confirm")
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .inputDialog {
- width: 600rpx;
- border-radius: 22rpx;
- background-color: #fff;
- overflow: hidden;
- &-head {
- padding-top: 50rpx;
- display: flex;
- flex-direction: row;
- justify-content: center;
- font-size: 32rpx;
- font-weight: 500;
- color: #333;
- }
-
- &-body {
- padding: 24rpx;
- }
-
- &-footer {
- display: flex;
- flex-direction: row;
- border-top: 1rpx solid #f5f5f5;
-
- &-btn {
- display: flex;
- flex: 1;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- height: 45px;
- font-size: 16px;
- color: #333;
- }
-
- &-l {
- color: #007aff;
- border-left-color: #f0f0f0;
- border-left-style: solid;
- border-left-width: 1rpx;
- }
- }
- }
- </style>
|