How to use customelement - 10 common examples

To help you get started, we’ve selected a few customelement examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mipengine / mip-extensions-platform / mip-lmb-script / mip-lmb-script.js View on Github external
define(function (require) {

    var $ = require('zepto');
    var customEle = require('customElement').create();
    customEle.prototype.build = function () {
        // URL跳转
        this.addEventAction('urlJump', function (event, url) {
            if (url) {
                location.href = url;
                // console.log(url);
            }
        });
        // 切换元素显示
        this.addEventAction('toggleEle', function (event, id) {
            if (id) {
                var elemen = document.getElementById(id);
                if (elemen.style.display === 'none') {
                    elemen.style.display = 'block';
                } else {
                    elemen.style.display = 'none';
github mipengine / mip-extensions-platform / mip-alading-interactions / mip-alading-interactions.js View on Github external
define(function (require) {
    function getUrlParam(name) { // 用于获取url的参数后置参数
        var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); // 构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg); // 匹配目标参数
        if (r != null) {
            return decodeURI(r[2]);
        }
        return null; // 返回参数值
    }
    var customEle = require('customElement').create();
    var $ = require('zepto');// 引入zepto
    customEle.prototype.firstInviewCallback = function () {
        // var baseUrl = 'http://test.xx-motor.com/';
        var baseUrl = 'https://yz-alipay.fundway.net/';
        var reg = /[^0-9a-zA-Z]/g;
        var reg1 = /[0-9a-zA-Z]/g;
        var shiche = ''; // 记录是车还是人
        var mianjian = 'false'; // 记录是免检还是没有免检
        // var weizhang = 'true';  记录有违章还是没违章
        var newsture = ''; // 记录查询信息是否有误 true为信息正确,false为信息错误
        var baofei = 'true'; // 是否达到报废条件
        var chaxun = 'none'; // 查询是否有结果
        var weihu = 'false'; // 查询系统是否维护中
        var chaxuned = 'false'; // 记录是否查询过
        var a = $(this.element).find('.bottom1_right'); // 六年免检按钮
        var b = $(this.element).find('#staus_right'); // 正常或达到报废标准的显示文本
github mipengine / mip-extensions-platform / mip-hsl-swt / mip-hsl-swt.js View on Github external
define(function (require) {
    var customElement = require('customElement').create();
    customElement.prototype.createdCallback = function () {
        var e = this.element;
        var s = e.getAttribute('hslid');
        var d = document.createElement('script');
		// 忠仕网站商务通在线客服系统,方便统计访客点击咨询来源以及数据
        d.src = 'https://ddt.zoosnet.net/JS/LsJS.aspx?siteid=' + s + '&float=1&lng=cn';
        d.language = 'javascript';
        e.appendChild(d);
    };
    return customElement;
});
github mipengine / mip-extensions-platform / mip-audit-xa / mip-audit-xa.js View on Github external
define(function (require) {

    var customElement = require('customElement').create();

    /**
     * 构造元素,只会运行一次
     */
    customElement.prototype.build = function () {
        // TODO
        this.element.innerHTML = 'hello test auto online news';
    };

    return customElement;
});
github mipengine / mip-extensions-platform / mip-233-tongji / mip-233-tongji.js View on Github external
define(function (require) {
    var $ = require('zepto');
    var customElem = require('customElement').create();
    // build 方法,元素插入到文档时执行,仅会执行一次
    customElem.prototype.build = function () {
        var element = this.element;
        var src = $(element).attr('data-host') + $(element).attr('data-query');
        var s = document.createElement('script');
        s.src = src;
        s.style.display = 'none';
        s.language = 'JavaScript';
        element.appendChild(s);
    };
    return customElem;
});
github mipengine / mip-extensions-platform / mip-em-hq / mip-em-hq.js View on Github external
define(function (require) {
    var customElem = require('customElement').create();
    var num = require('./em-hqnum');
    var common = require('./em-hqcommon');
    var $ = require('zepto');

    // 第一次进入可视区回调,只会执行一次,做懒加载,利于网页速度
    customElem.prototype.firstInviewCallback = function () {
        var scode = common.getQueryString('code') || '300059';
        var smkt = common.getMkt(scode);
        var stockcode = scode + smkt;
        num.intital(stockcode);
    };
    return customElem;
});
github mipengine / mip-extensions-platform / mip-tiantis-jsridge / mip-tiantis-jsridge.js View on Github external
define(function (require) {
    var customElem = require('customElement').create();
    var $ = require('jquery');
    // 页面DOM加载完成后调用,初始化页面里面的DOM事件绑定等。
    customElem.prototype.build = function () {
        $.getScript('//ui.tiantis.com/Scripts/MShopDec/PublishNew.js?version=v2&t='
                + Math.random(), function () {});
    };
    return customElem;
});
github mipengine / mip / test / element.js View on Github external
beforeEach(function () {
            MipTestElement = customElement.create();
        });
github mipengine / mip / test / customElement.js View on Github external
define(function (require) {
    'use strict';

    var $ = require('zepto');
    var customElement = require('customElement');
    var registerElement = require('element');
    var Created = customElement.create();

    describe('customElement', function () {
        var cElement;

        beforeEach(function () {
            cElement = new Created();
        });

        afterEach(function () {
            cElement = null;
            $('.mip-element').remove();
        });

        describe('default method validation', function () {
            [
                'applyFillContent',
github mipengine / mip-extensions-platform / mip-sn-shop-floor / mip-sn-shop-floor.js View on Github external
define(function (require) {

    var customEle = require('customElement').create();
    var templates = require('templates');
    var fetchJsonp = require('fetch-jsonp');

    /**
     * 获取URL参数
     *
     * @return {boolean}
     */
    function getUrlParam() {
        var t = location.href.split('?');
        var o = t[1] ? t[1].split('&') : [];
        var e = {};

        if (!o.length) {
            return false;
        }

customelement

custom-button

MIT
Latest version published 7 years ago

Package Health Score

40 / 100
Full package analysis

Popular customelement functions