123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- <template>
- <view class="base-popup">
- <u-popup
- :show="show"
- :round="10"
- mode="center"
- @close="close"
- :customStyle="popupCustomStyle"
- :closeOnClickOverlay="false"
- >
- <view class="header flex justify-between align-center">
- <view class="u-font-16 u-font-500" :style="titleStyle">{{ title }}</view>
- <u-icon :bold="true" name="close" color="#1E252B" size="16" @click="close()"></u-icon>
- </view>
- <view class="main">
- <slot name="main"></slot>
- </view>
- <view class="footer flex justify-between">
- <view>
- <slot name="footerLeft"></slot>
- </view>
- <view class="flex align-center">
- <u-button
- class="u-m-r-16"
- :customStyle="closeCustomStyle"
- @click="close()"
- v-if="cancelShow"
- >{{ cancelText }}</u-button
- >
- <u-button type="primary" :customStyle="confirmCustomStyle" @click="confirm()">{{
- confirmText
- }}</u-button>
- </view>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- export default {
- name: 'base-popup',
- props: {
- show: {
- type: Boolean,
- default: false,
- },
- title: {
- type: String,
- default: '标题',
- },
- width: {
- type: String,
- default: '520px',
- },
- fontWeight: {
- type: String,
- default: '',
- },
- cancelText: {
- type: String,
- default: '取消',
- },
- confirmText: {
- type: String,
- default: '确认',
- },
- cancelShow: {
- type: Boolean,
- default: true,
- },
- },
- data() {
- return {};
- },
- computed: {
- titleStyle() {
- let { fontWeight } = this;
- return {
- fontWeight,
- };
- },
- popupCustomStyle() {
- return {
- width: this.width,
- };
- },
- closeCustomStyle() {
- return {
- width: '84px',
- height: '36px',
- border: '1px solid #d3d6d8',
- color: '#1E252B',
- };
- },
- confirmCustomStyle() {
- return {
- width: '84px',
- height: '36px',
- background: '#2196F3',
- };
- },
- },
- methods: {
- close() {
- this.$emit('update:show', false);
- this.$emit('close');
- },
- confirm() {
- this.$emit('confirm');
- },
- },
- };
- </script>
- <style lang="scss">
- .base-popup {
- .header {
- padding: 16px 24px;
- }
- .main {
- padding: 24px;
- border-top: 1px solid #eaebec;
- border-bottom: 1px solid #eaebec;
- }
- .footer {
- padding: 16px 20px;
- }
- }
- </style>
|