如果 dojox.mobile 选择器是您要寻找的,则需要将其附加到覆盖层。没有直接的依恋。像 dijit/datetextbox。如果移动选择器是您想要的,下面就是一个示例。
使用开瓶器时,在 show() 内部是您告诉它附加什么的地方。
<div id="customPicker" data-dojo-type="dojox/mobile/Opener" data-dojo-props="onHide:setDeliveryDate">
<h1 data-dojo-type="dojox/mobile/Heading" label="Custom Picker">
<div data-dojo-type="dojox/mobile/ToolBarButton" label="Done" class="mblColorBlue" style="width:45px;float:right;" onClick="dijit.registry.byId('customPicker').hide()"></div>
</h1>
<div id="dateSpinner" data-dojo-type="dojox/mobile/DatePicker" data-dojo-props="monthPattern:'MM', dayPattern:'dd'"></div>
</div>
<input id="dateField" onclick="dijit.registry.byId('customPicker').show(this)"></input>
和脚本::
require(["dojo","dojox/mobile/Opener","dojox/mobile/Heading", "dojox/mobile/ToolBarButton","dojox/mobile/DatePicker", "dijit/registry"])
function setDeliveryDate(){
var spin =dijit.registry.byId("dateSpinner");
dojo.byId("dateField").value = spin.slots[1].value + "/" + spin.slots[2].value + "/" + spin.slots[0].value;
}
小提琴:http: //jsfiddle.net/PrJzp/
编辑::
要在跨度中使用日历,请使用 dijit/Calendar 组件。
require([
"dijit/Calendar",
"dojo/date",
"dojo/domReady!"
], function(Calendar, date){
new Calendar({
value: new Date(),
}, "SpanWhereCalendarIS");
});
https://dojotoolkit.org/reference-guide/1.9/dijit/Calendar.html