index.vue 1.66 KB
<template>
  <van-overlay :show="showNotice" z-index="1000">
    <div class="wrapper" @click.stop>
      <div class="block">
        <div style="position: absolute; top: -2rem; right: 1rem; font-size: 1.5rem;">
          <van-icon name="close" color="#FFFFFF" @click="handleClose" />
        </div>
        <div>
          <van-image width="100" height="100" :src="icon_notice" />
          <p style="margin: 1rem; font-size: 1.15rem; font-weight: bold; color: #222222;">温馨提示</p>
        </div>
        <slot></slot>
        <div style="margin: 3rem 0;">
          <my-button @on-click="handleSubmit" type="primary">{{ text }}</my-button>
        </div>
      </div>
    </div>
  </van-overlay>
</template>

<script setup>
import MyButton from '@/components/MyButton/index.vue'
import icon_notice from '@images/que-tishi@2x.png'

import { ref, reactive, onMounted } from 'vue'
const props = defineProps({
  showNotice: Boolean,
  text: String
})
const emit = defineEmits(['on-close', 'on-submit']);

let show = props.showNotice;

const handleClose = () => { // 关闭提示框回调
  show = false
  emit('on-close', false)
}
// 底部按钮
const handleSubmit = () => {
  emit('on-submit', false)
}

onMounted(() => {

})
</script>

<script>
export default {
  data() {
    return {

    }
  },
  mounted() {

  },
  methods: {

  }
}
</script>

<style lang="less" scoped>
.wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: auto;
  text-align: center;
}

.block {
  width: 80%;
  // height: 25rem;
  background-color: #fff;
  border-radius: 10px;
  padding: 1rem;
  position: relative;
  margin-top: 1rem;
  margin-bottom: 5rem;
}
</style>