MIP other functions introduce the function of MIP to promote development efficiency

Source: Internet
Author: User
Tags require

Prerenderelement

Rendering MIP elements in advance.

If the element is not within viewport, force the Viewportcallback Firstinviewcallback method of the element to be triggered.

Varelement =document.getelementbyid (' mip-test ');

Mip.prerenderelement (Element);

Event-action

Because MIP is not allowed to use additional JS code. This provides a set of event action mechanisms that can trigger a custom event for a MIP element through a DOM property.

Html:

<mip-testid= "Test" ></mip-test>

<divon= "Tap:test.custom_event" > with no Parameters </div>

<divon= "Tap:test.custom_event (Test_button)" > with Parameters </div>

<divon= "Tap:test.custom_event (Test_button) tap:test.custom_event (test_button1)" > Multiple Events </div>

Js:

Mip-test.js

Define (function (require) {

var customele =require (' Cust omelement '). Create ();

CustomEle.prototype.build =function () {

Binding events, other elements can be triggered by on= "XXX"

This.addeventaction ("Custom_event", Function (event/* corresponding Event object//, str/* event Parameters * *) {

Console.log (str);//undefined or ' test_button ' or ' test_button1 '

});

};

Returncustomele;

});

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.