| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <template>
- <ui-dialog>
- <template v-if="$slots.content">
- <slot name="content" />
- </template>
- <template v-else>
- <img :src="centerIcon" alt="">
- <div class="message" v-html="content"></div>
- </template>
- <template v-slot:footer v-if="!hideFoot">
- <img class="button" v-if="!single" type="cancel" @click="close('no')" :src="noImg" alt="">
- <img class="button" @click="close('ok')" :src="okImg" alt="">
- </template>
- <template v-slot:closeIcon>
- <img :src="closeImg" @click="close('no')" class="close" alt="">
- </template>
- </ui-dialog>
- </template>
- <script>
- import { defineComponent } from 'vue'
- import { isFunction, omit } from '../../utils'
- export default defineComponent({
- name: 'ui-confirm',
- props: {
- centerIcon: {
- type: String,
- default: `${config.cdn_url}images/icon_tip3.png`,
- },
- okImg: {
- type: String,
- default: `${config.cdn_url}images/btn_giveup.png`,
- },
- noImg: {
- type: String,
- default: `${config.cdn_url}images/btn_cancel2.png`,
- },
- closeImg: {
- type: String,
- default: `${config.cdn_url}images/icon_cancel_b.png`,
- },
- single: {
- type: Boolean,
- default: false,
- },
- hideFoot: {
- type: Boolean,
- default: false,
- },
- func: Function,
- content: String,
- destroy: Function,
- },
- setup: function (props, ctx) {
- const close = result => {
- if (isFunction(props.func) && props.func(result) === false) {
- return
- }
- isFunction(props.destroy) && props.destroy()
- }
- return {
- ...omit(props, 'destroy', 'func'),
- close,
- }
- },
- })
- </script>
|