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; }); |