Git Product home page Git Product logo

webcoms's Introduction

一些webui组件

为什么要重复造轮子呢?
其意义不再于造了更劣质的轮子,而是熟悉造法.
Document

mirrorui 模仿bt

学习bootstrap快速增加前端熟悉度,模仿它做一个webui

msgbox 弹出层

弹出框,模仿了alert confirm prompt
弹出自定义html片段
修改成js原生,没有用jquery了
示例页:msgbox/index.html

// 弹出alert
msgbox.alert('alert框');

// 弹出confirm
msgbox.confirm('confirm标题',callback);

// 弹出prompt
msgbox.prompt('输入信息',callback);

// 弹出自定义框
msgbox.show(innerhtml)

MyDatePick 日期时间

日期选框,参考自火狐浏览器自带的日期框
支持年月日,可选时分秒,选择方便
示例页:mydatepick/index.html

// 在input上调用MyDatePick方法
<input onclick="MyDatePick()" type="text" />

// 需要时分秒
<input onclick="MyDatePick({fmt:'datetime'})" type="text">

cachepage 缓存页

组件的主要能力是使用createDocumentFragment这个API将页面缓存为DOM片段.由于片段不在文档流内,所以不会影响当前HTML文档.
示例页:cachepage/index.html

// 选项卡框Dom对象
let tabsDom = document.getElementById('tabsbox1');
// 显示内容Domc对象
let contDom = document.getElementById('mainbox');

// cachepage 实例化
let cpg = cachepage(tabsDom, contDom);
// 主要方法
let cacheDom = cpg.load(页面id, 选项卡标题);

if (cacheDom) {
    contDom.append(cacheDom);
}

pagenum 分页条

组件按钮 上一页,1页,当前页前几页,当前页,当前页后几页,最后页,下一页,总页数,跳转页输入框,确定
示例页:pagenum/index.html

<nav class="pagenum" id="testpagenumbox1"></nav>

function newpagenum(pnnum) {
    let cfg = {
        // 容器ID(必须)
        domId: 'testpagenumbox1',
        // 点击事件(必须)
        pageClickE: newpagenum,
        // 总数(必须) >0 由后端返回新的总数
        totalData: 96,
        // 当前页码(必须) >0 由后端返回当前页码,或者页面记住当前请求页面
        pageIndex: pnnum,
        // 每页数量 [5-50]
        pageSize: 10,
        // 显示几个按钮[5-10]
        totalBtn: 5
    }
    pagenum(cfg);
}
newpagenum(1);

webcoms's People

Contributors

mirrortom avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.