is to write a method to control data through data, for example:
<input type="text" data-tap="true" data-format="2018-08-16" class="data-input mui-input-clear" placeholder="">
use data-format and data-tap to control what the input can click on, and will open a date selection panel with a date format of 2018-08-16
.I wrote that a new app.js, has been created and loaded in the page.
/**
* Date Select
*
*/
(function($, owner) {
//
owner.selectDateClickEvent = function(options) {
if(typeof options == "undefined" || options == null || options == String){
return options == {};
}
//input
var inputTap = document.getElementsByTagName("data-input");
mui.trigger(inputTap,"tap");
//input
var defaults = {
tap:null,
format:null
}
//
var target = this;
target.attr("data-tap", options.tap);
target.attr("data-format", options.format);
target.empty();
target.attr("value", "");
target.text(options.placeholder);
mui.extend(defaults,options);
//
var Sdate = new Date();
var month = Sdate.getMonth() + 1;
var strDate = Sdate.getDate();
if(month >= 1 && month <= 9) {
month = "0" + month;
}
if(strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var currentdate = Sdate.getFullYear() + "-" + month + "-" + strDate;
Sdate.setFullYear(currentdate);
//
plus && plus.nativeUI.pickDate(function(e){
var d=e.date;
})
}
}(mui, window.abc={}));
is then called in the selected date, because this is the first time it is written like this, it cannot be checked what caused it, that is, the selectDateClickEvent method is not executed.
is the way to use mui:
abc.selectDateClickEvent();
Please which god is free to help me, thank you!