zoukankan      html  css  js  c++  java
  • easyui容易被忽略掉的部分

    官方文档有这么一段话:

    Each component of easyui has properties, methods and events. Users can extend them easily.

    Properties

    The properties is defined in jQuery.fn.{plugin}.defaults. For example, the dialog's properties is defined in jQuery.fn.dialog.defaults.

    Events

    The events(callback functions) is defined in jQuery.fn.{plugin}.defaults also.

    Methods

    The calling method syntax: $('selector').plugin('method', parameter);

    Where:

    • selector is the jquery object selector.
    • plugin is the plugin name.
    • method is the existing method corresponding to the plugin.
    • parameter is the parameter object, can be a object, string, ...

    The methods is defined in jQuery.fn.{plugin}.methods. Each method has two parameters: jq and param. The first parameter 'jq' is required, which refers to that jQuery object. The second parameter 'param' refers to the really parameter that pass through the method. For example, to extend a method named 'mymove' for the dialog component, the code looks like this:

    1. $.extend($.fn.dialog.methods, {
    2. mymove: function(jq, newposition){
    3. return jq.each(function(){
    4. $(this).dialog('move', newposition);
    5. });
    6. }
    7. });

    Now you can call 'mymove' method to move the dialog to specified position:

    1. $('#dd').dialog('mymove', {
    2. left: 200,
    3. top: 100
    4. });

    这段话其实描述了easyui使用的基本思路,以及扩展的思路。jQuery.fn.{plugin}.defaults,jQuery.fn.{plugin}.defaults,jQuery.fn.{plugin}.methods 分别是三部分的定义位置,可以对这三个定义分别扩展(添加和重写)。

  • 相关阅读:
    Pycharm中导入Python包的方法
    关于SOA架构设计的案例分析
    浅谈12306核心模型设计思路和架构设计
    美图数据统计分析平台架构演进
    有赞搜索系统的架构演进
    美团云的网络架构演进之路
    数据蜂巢架构演进之路
    1号店电商峰值与流式计算
    京东B2B业务架构演变
    饿了么:业务井喷时订单系统架构的演进
  • 原文地址:https://www.cnblogs.com/qook/p/5666054.html
Copyright © 2011-2022 走看看