All files / src/components/u-router-view.vue index.vue

68.42% Statements 13/19
16.66% Branches 2/12
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      7x     7x                     7x                               7x 7x            
<template>
    <div :class="$style.fake" v-if="$env.VUE_APP_DESIGNER" :designer="$env.VUE_APP_DESIGNER && designer">
        <router-view></router-view>
    </div>
    <router-view v-else-if="disableKeepAlive"></router-view>
    <keep-alive v-else>
        <router-view></router-view>
    </keep-alive>
</template>
 
<script>
export default {
    name: 'u-router-view',
    props: {
        designer: { type: Boolean, default: true },
        disableKeepAlive: { type: Boolean, default: true },
    },
};
</script>
 
<style module>
.fake:empty {
    min-height: 32px;
    text-align: center;
}
.fake[designer]:empty {
    background: linear-gradient(-45deg, white 25%,
    #f3f5fa 25%, #f3f5fa 50%,
    white 50%, white 75%,
    #f3f5fa 75%);
    background-size: 45px 45px !important;
    background-repeat: repeat !important;
}
.fake:empty:after {
    content: '此容器为子页面呈现占位,可在子页面编辑内容';
    font-size: 12px;
    line-height: 32px;
    color: var(--font-second-color);
}
</style>