1***@qq.com
1***@qq.com
  • 发布:2019-03-01 19:44
  • 更新:2019-03-27 21:03
  • 阅读:977

DtPicker只显示遮蔽页,样式显示错误。

分类:MUI

参照的官网原声UIapi。直接上代码
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>岗位需求发布</title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" type="text/css" href="../../css/mui.min.css" />
<link rel="stylesheet" type="text/css" href="../../css/mui.picker.css" />
<link rel="stylesheet" type="text/css" href="../../css/mui.poppicker.css" />
<script src="../../js/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/mui.picker.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/mui.poppicker.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<script type="text/javascript" charset="utf-8">
mui.init();
mui.ready(function() {
var dtPicker = new mui.DtPicker({
"type": "date"
});
dtPicker.show(function(selectItems) {
console.log(selectItems.y); //{text: "2016",value: 2016}
console.log(selectItems.m); //{text: "05",value: "05"}
});
});
</script>
</body>
</html>
样式错误。如图:

2019-03-01 19:44 负责人:无 分享
已邀请:
1***@qq.com

1***@qq.com (作者) - 养娃ing

问题已经,css文件引用错误。
应该引用mui.picker.min.css文件。

F_hawk189

F_hawk189 - 想当产品经理的程序猴

老哥,我引用了 mui.picker.picker.min.css为什么样式还是不行
<link rel="stylesheet" type="text/css" href="../css/mui.picker.css" />
<link rel="stylesheet" type="text/css" href="../css/mui.poppicker.css" />
<link rel="stylesheet" href="text/css" href="../css/mui.min.css">
<link rel="stylesheet" href="text/css" href="../css/mui.picker.min.css">

<li class="mui-table-view-cell" id="s_start_time">
<a class="mui-navigate-right">
起始时间<span class="ul_li_span" id="startDateSelect"></span>
</a>
</li>
<script src="../../js/mui.min.js"></script>
<script src="../../js/mui.picker.js"></script>
<script src="../../js/mui.picker.min.js"></script>
<script src="../../js/mui.poppicker.js"></script>
<script src="../../js/global.js"></script>
var dtPicker = new mui.DtPicker({
type:'date'
});

            document.getElementById('s_start_time').addEventListener('tap', function(event) {  
                dtPicker.show(function(selectItems) {  
                    document.getElementById('startDateSelect').innerHTML = selectItems[0].text;  
                    var a_id = selectItems[0].value;  
                    // localStorage.setItem('add_study_address_id', a_id);  
                    console.log(a_id);  

                })  
            });
  • F_hawk189

    问题解决了,应该是样式之间出现了某种冲突吧,也不知道什么原因,最初我的CSS引入是这样的的:

    <!-- <link href="../css/mui.min.css" rel="stylesheet" /> -->

    <!-- <link rel="stylesheet" type="text/css" href="../css/mui.picker.css" /> -->

    <!-- <link rel="stylesheet" type="text/css" href="../css/mui.poppicker.css" /> -->

    <!-- <link rel="stylesheet" href="text/css" href="../css/mui.picker.min.css" /> -->

    <!-- <link rel="stylesheet" href="text/css" href="../css/mui.dtpicker.css" /> -->

    因为一直没好,所以引入的CSS多了,

    后来改成这样了:

    <link rel="stylesheet" type="text/css" href="../css/mui.min.css" />

    <link rel="stylesheet" type="text/css" href="../css/mui.picker.min.css" />

    <link rel="stylesheet" type="text/css" href="../css/mui.poppicker.css" />

    好了

    2019-03-28 14:35

该问题目前已经被锁定, 无法添加新回复