Giter Site home page Giter Site logo

dialog's Introduction

Dialog


基础对话框组件,提供对话框显示隐藏、dom 结构自定义、定位、select 遮挡、确定取消关闭等功能特性。

对话框图


配置说明

trigger element

对话框触发元素,可传递选择器。

triggerType string

对话框触发方式,可选 click|hover|focus ,默认为click。

element element

对话框的浮层元素。

template string

对话框的浮层模板,和 element 参数二选其一即可(注:confirm-box 有自带模板)。

title string|function

指定标题,可以是 html 字符串。

content string|function

指定内容,可以是 html 字符串(甚至包括 <iframe src="test.html">)。

onConfirm function

确定时的操作,可在函数内使用this.activeTrigger得到触发节点,下同。

onClose function

关闭时的操作。

hasMask boolean

是否有背景遮罩层。

其他配置参照overlay

实例方法

参照overlay

事件说明

以下两个事件和配置中的 onConfirmonClose 作用相同,调用方式不同。

dialogInstanse.on('confirm', function() {
    // ...
});

confirm

点击确定时的操作。

close

关闭时的操作。


最佳实践

seajs.use('arale/dialog/{{版本号}/base-dialog}', function(BaseDialog) {
    var o = new BaseDialog({
        trigger: '#trigger',
        template: '<div class="overlay"><button id="close">点击关闭</button></div>',
        width: 300,
        height: 200,
        align: {
            baseXY: [100, 100]
        },
        hasMask: true
    });
};

注意,需要用data-role="title"这样的属性来标示 html 节点的作用,目前支持的 role 有title(标题节点)、content(内容节点)、confirm(确定按钮)、cancel(取消按钮)、close(关闭按钮)。

dialog's People

Contributors

afc163 avatar leoner avatar lianqin7 avatar lifesinger avatar popomore avatar shaoshuai0102 avatar

Watchers

 avatar  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.