All files / src/components/u-absolute-layout.vue index.vue

68.42% Statements 13/19
14.28% Branches 2/14
33.33% Functions 1/3
72.22% Lines 13/18

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      7x     7x                   7x           7x 7x                                                        
<template>
    <div :class="[$style.root, {[$style.empty]: (!$slots.default) && $env.VUE_APP_DESIGNER && !!$attrs['vusion-node-path']}]" v-on="$listeners" vusion-slot-name="default">
        <slot></slot>
        <template v-if="(!$slots.default) && $env.VUE_APP_DESIGNER && !!$attrs['vusion-node-path']">
            <div :class="$style.emptyTip">拖入组件放至任意位置</div>
        </template>
    </div>
</template>
 
<script>
 
export default {
    name: 'u-absolute-layout',
};
</script>
 
<style module>
.root {
    position: relative;
    width: 100%;
    height: 300px;
    min-height: 30px;
}
.root.empty{
    background: #F7F8FA;
}

.root>* {
    position: absolute !important;
    text-decoration: inherit;
}
/* 在编辑器里禁用 transition,防止位置尺寸变化时候出现延迟 */
.root>[vusion-node-path]{
    transition: none !important;
}
.emptyTip {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: #999;
}
.emptyTip::before {
    icon-font: url("./assets/drag-in-copy.svg");
    font-size: 12px;
    margin-right: 5px;
    position: relative;
    bottom: 1px;
}
</style>