zoukankan      html  css  js  c++  java
  • 组件封装-无数据组件

    1. 组件内容

    <template>
      <div class="common_nodata_box" :style="{height: height}">
        <div class="common_nodata_bg" :style="{background: `url(${noDataImage}) no-repeat center center`}"></div>
        <span>{{text}}</span>
      </div>
    </template>
    
    <script>
    import noDataImage from "@/assets/commonNodata.png";
    export default {
      name: "commonNoData",
      props: {
        text: {
          type: String,
          default: "抱歉,暂无数据"
        },
        height: {
          type: String // 比如:"600px"
        },
        noDataImage: {
          default: noDataImage
        }
      }
    };
    </script>
    
    <style lang="less" scoped>
    .common_nodata_box {
       100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      color: #999999;
      font-size: 14px;
      .common_nodata_bg {
         150px;
        height: 120px;
      }
    }
    </style>
    

    2. 使用

    <template>
      <div>
        <div v-if="hasData">内容</div>
        <CommonNoData v-else height="600px" :noDataImage="require('@/assets/pic-02.png')" text="无数据"></CommonNoData>
      </div>
    </template>
    
    <script>
    import CommonNoData from "@/components/common-nodata";
    export default {
      components: {
        CommonNoData
      },
      data() {
        return {
          hasData: true
        };
      }
    };
    </script>
    
  • 相关阅读:
    整型
    圆的面积和周长
    买菜
    keil 生成 bin 文件 gd32为例
    内存中 1k 代表什么
    正反转 步进电机 驱动器 编码器
    stlink 无法再keil中识别 按下复位键可以识别
    单片机的时钟,系统时钟
    db9串口接头的定义
    E面波导和H面波导的问题
  • 原文地址:https://www.cnblogs.com/XHappyness/p/12426901.html
Copyright © 2011-2022 走看看