<template>
<div :style="{color: fontColor}" :class="['noDataView', iconType]">
<div class="icon">
<icon-svg type="svgIcon_emptyDataClient"></icon-svg>
</div>
</div>
<div class="text">{{explain}}</div>
</template>
<script type="text/ecmascript-6">
/**
*
* noDataView组件
*
*/
export default {
name: 'noData-view',
data() {
return { }
},
computed: {
iconType() {
if(this.type === '1') {
return 'big'
} else {
return 'normal'
}
}
},
props: {
/**
* 样式类型 1:大图标 2:小图标
*/
type: {
type: string,
default: '1'
},
/**
* 默认字体颜色
*/
fontCOlor: {
type: string,
default: '#43484D'
},
/**
* 图片说明
*/
type: {
type: string,
default: '暂无记录'
}
}
}
</script>
<style lang="less" scoped>
.noDataView {
position: absolute;
top: 50%;
left: 50%;
.icon {
font-size: 2.1rem;
height: 2.1rem;
width: 100%;
}
.text {
width: 100%;
text-align: center;
}
}
.big {
height: 2.8rem;
width: 2.1rem;
margin-top: -1.4rem;
margin-left: -1.05rem;
.icon {
font-size: 2.1rem;
height: 2.1rem;
}
.text {
font-size: .2rem;
height: .3rem;
line-height: .3rem;
margin-top: .4rem;
}
}
.normal {
height: 1.4rem;
width: 1rem;
margin-top: -0.7rem;
margin-left: -0.5rem;
.icon {
font-size: 1rem;
height: 1rem;
}
.text {
font-size: .12rem;
height: .2rem;
line-height: .2rem;
margin-top: .3rem;
}
}
</style>

以上代码是组件noData-view组件。具体引用如下:

<div class="nodata-view" v-if="!list.length">
<noData-view type="2" fontCOlor="#979EA7" explain="该列表暂无数据" />
</div>
<script>
import NoDataView from './noData-view';
export default {
data() {
return {
list: []
}
},
components: {
NoDataView
}
}
</script>

Vue 封装的noData组件的更多相关文章

  1. vue封装一些常用组件loading、switch、progress

    vue封装一些常用组件loading.switch.progress github文档https://github.com/zengjielin/vue-component-library loadi ...

  2. Vue 封装的loading组件

    <template> <div class="loadEffect"> <span></span> <span>< ...

  3. echart——vue封装成公共组件

    <!-- 自定义Echarts * options: Object,//数据 * theme: String,//主题 * initOptions: Object,//初始化 * group: ...

  4. 基于Vue封装分页组件

    使用Vue做双向绑定的时候,可能经常会用到分页功能 接下来我们来封装一个分页组件 先定义样式文件 pagination.css ul, li { margin: 0px; padding: 0px;} ...

  5. vue防抖节流函数---组件封装,防止按钮多次点击

    1.vue 封装utils.js /** * @param {function} func 执行函数 * @param {number} time 防抖节流时间 * @param {boolean} ...

  6. Vue + Element-ui实现后台管理系统(4)---封装一个ECharts组件的一点思路

    封装一个ECharts组件的一点思路 有关后台管理系统之前写过三遍博客,看这篇之前最好先看下这三篇博客.另外这里只展示关键部分代码,项目代码放在github上: mall-manage-system ...

  7. vue 封装组件

    props 接收数据 props对象里面 键值 是对改数据的 数据类型 的规定.做了规范,使用者就只能传输指定类型的数据,否则报警告 先根据要求写出完整的代码,再一一用参数实现组件封装 这里试着封装一 ...

  8. echars vue 封装全局组件 曲线 柱状图 同v-chars绿色系 配置样式

    Echars vue封装 ,曲线图 <!DOCTYPE html> <html lang="en"> <head> <meta chars ...

  9. vue封装分页组件

    element提供的分页是已经封装好的组件,在这里再次封装是为了避免每个用到分页的页面点击跳转时都要写一遍跳转请求 分页组件 <!--分页组件--> <template> &l ...

随机推荐

  1. MapServer Configuring with IIS

    MapServer Configuring with IIS 一.前言 1.MapServer简介 MapServer是一个用C语言编写的开源地理数据呈现引擎.除了浏览地理信息系统数据之外,MapSe ...

  2. ansible的管理与剧本

    首先我们安装一个ansible. 在7版本,直接用yum安装就可以 yum -y install ansible 然后清空ansible的配置文件,在里面写入自己需要管理的服务器的ip和相应的登陆密码 ...

  3. [Codeforces771E]Bear and Rectangle Strips

    Problem 给你一个2*n的矩阵,要求你用补充叠的矩阵去框,要求每个矩阵框中的数之和为0,问最多可以用几个矩阵. Solution 首先预处理出一个点到离它最近的一段和为0的区间的左端点 然后到这 ...

  4. zookeeper基本概念

    1.集群角色 Leader,Follower,Observer Leader服务器是整个zookeeper集群工作机制中的核心 Follower服务器是zookeeper集群状态的跟随者 Observ ...

  5. Linux中修改环境变量及生效方法(永久、临时)环境变量查看

    参考link:https://blog.csdn.net/u011630575/article/details/49839893 在项目中有一次帮忙组里搭环境时遇见了这部分的相关操作,记录一下.

  6. css实现半圆和圆

    1.半圆 半圆分为:上半圆.下半圆.左半圆.右半圆,我们只要学会制作某一个方向的半圆,其他方向的半圆都可以轻松实现,其原理都一样. 假如我们要制作上半圆,实现原理:把高度height设置为宽度widt ...

  7. groupadd语法

    groupadd [选项] 组 创建一个新的组.Groupadd命令使用命令行中指定的值加上系统默认值创建新的组账户.新组将根据需要输入系统. (1).选项 1 2 3 4 5 6 7 -f,--fo ...

  8. 我的代码-data pulling

    # coding: utf-8 import datetimeimport timefrom sqlalchemy.engine import create_enginefrom sqlalchemy ...

  9. list基本代码

    #include<iostream> #include<list> //STL之list的基本用法 using namespace std; void outputList(l ...

  10. react-router 父子路由同时要接收 params 的写法

    <Route path="/profile/:companyId/:companyName" component={Profile} onEnter={(nextState, ...