2 Star 3 Fork 0

NMS丶No3 / datav-vite

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

English | 简体中文

datav-vite

一个快速生成可视化模板的vue插件

这个插件是什么?我们一般都会遇到公司让我们写一个或多个简单的大屏可视化,上面可能会有图表,炫酷的动画,文本等。 此时,你需要想怎么去适配屏幕分辨率啊,这时你会想什么网格布局啊,那我们能不能有一个统一的模板呢?我不关心屏幕的适配,我只关心这个大屏需要展示什么内容。

于是,就有了这样一个组件 - datav-vite(快速构建可视化大屏或数据大屏)。你不需要关心需要设计什么算法,你只管拿到ui的涉及稿,按照ui上的布局位置,将每个组件安置在固定的位置。

还是不懂?看个例子? 参考一个完整的例子,点击这里

其实就是两个组件 一个父亲组件负责渲染背景图和提供缩放算法 一个子组件为不同的图形组件提供包装,使其具备绝对布局的功能

演示效果

avatar

在线demo

国内站点 点击这里查看

git站点 点击这里查看

安装

npm install --save datav-vite

使用

import DatavVite from 'datav-vite';
Vue.use(DatavVite);

使用

<template>
  <div id="app">
    <DataVTemplate :palette="palette" :scaleMode="mode">
      <DataVCell :partStyle="partStyle">
            <!-- 这里放置echarts的折线图 -->
        </DataVCell>
        <DataVCell :partStyle="partStyle">
            <!-- 这里放置antD的折线图 -->
        </DataVCell>
    </DataVTemplate>
  </div>
</template>

<script lang="ts">
import bg from './assets/bg.png'
const enum ScaleMode {
    // 等比缩放
    EQUAL = 1,
    // 宽度铺满,高度等比缩放
    HSCALE,
    // 高度铺满,宽度等比缩放
    WSCALE,
}

export default {
  name: 'app',
  data: () => {
    return {
      palette: {
        backgroundImage: bg,
      },
      mode: ScaleMode.HSCALE,
      partStyle: {
        height: 100,
        width: 100,
        top: 0,
        left: 0,
      }
    }
  }
}
</script>

api

DataVTemplate属性api

const enum ScaleMode {
    // 根据屏幕的分辨率,等比缩放
    EQUAL = 1,
    // 宽度铺满,高度等比例缩放
    HSCALE = 2,
    // 高度铺满,宽度等比例缩放
    WSCALE = 3,
}

interface Palette {
    // 背景色,无背景图时,用背景色填充
    backgroundColor: string;
    // 背景图
    backgroundImage: '',
}
属性 描述 类型 默认值
screenW 屏幕分辨率的宽度 Number 1920
screenH 屏幕分辨率的高度 Number 1080
scaleMode 屏幕预览类型 Number (ScaleMode) 3
disabledBackgroundFill 禁止超出的背景以背景图填充 Boolean false
palette 色盘 Palette { backgroundColor: '#000' }

DataVCell属性api

const enum PartStyle {
    width: number,
    height: number,
    left: number,
    top: number,
    zIndex: number,
}
属性 描述 类型 默认值
partStyle 赋予一个组件为绝对布局,需要用户输入该组件的宽高,位置和组件的堆叠顺序 PartStyle -
MIT License Copyright (c) 2019 chuxiaoguo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

一个快速生成可视化模板的vue插件 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/chuxiaoguo/datav-vite.git
git@gitee.com:chuxiaoguo/datav-vite.git
chuxiaoguo
datav-vite
datav-vite
master

搜索帮助