Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | <script> import UPopupReal from './index.vue'; import i18nMixin from '../../mixins/i18n'; const normalizeSlots = (slots, context) => Object.keys(slots) .reduce((arr, key) => { slots[key].forEach((vnode) => { if (!vnode.context) { slots[key].context = context; } if (!vnode.data) { vnode.data = {}; } vnode.data.slot = key; }); return arr.concat(slots[key]); }, []); export default { name: 'u-visible-popup', // i18n: UPopupReal.i18n, mixins: [i18nMixin('u-popup')], components: { UPopupReal, }, props: UPopupReal.props, data() { return { currentOpened: true, }; }, watch: { currentOpened(currentOpened) { this.$refs.popup.currentOpened = currentOpened; }, }, methods: { // 双击打开弹出框 designerDbControl() { this.$refs.popup.currentOpened = !this.$refs.popup.currentOpened; }, send(data) { const dataString = JSON.stringify(data); console.info('[vusion:designer] Send: ' + dataString); // (dataString.length > 100 ? dataString.slice(0, 100) + '...' : dataString)); window.parent.postMessage({ protocol: 'vusion', sender: 'designer', data }, '*'); }, }, render(h) { const slots = normalizeSlots(this.$slots, this.$vnode.context) || []; this.$attrs.reference = '$parent'; return h('div', { style: { background: '#FAFAFA', border: '1px dashed #C3C3C3', // alignItems: 'center', // justifyContent: 'center', // display: 'flex', padding: '15px', cursor: 'pointer', }, }, [ h('u-popup-real', { class: this.class, style: this.style, attrs: this.$attrs, props: this.$props, scopedSlots: this.$scopedSlots, ref: 'popup', }, slots), h('div', {}, ['双击打开/关闭弹出框']), ]); }, }; </script> |