用的是jquery和zepto
先在webpack.base.conf.js里
externals: {
'zepto': 'Zepto',
'jquery': 'jQuery'
},
再是index.html里引入
<script type="text/javascript" src="./static/js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="./static/js/zepto.js"></script>
再在index.html里写js代码
window.onload = function() {
var tcBtn = $("#select");
var tc = $("#selectTc");
tcBtn.bind("tap", function() {
$(".scroll").css({
"height":"80vh",
"overflow": "hidden"
});
tc.show(80, function() {
tc.find(".tc-left").animate({
left: '0'
}, 400);
});
});
tc.find(".tc-right").bind("tap", function() {
tc.find(".tc-left").animate({
left: '-80%'
}, 400, function() {
tc.hide();
$(".scroll").css({
"height":"auto",
"overflow": "scroll"
});
});
});
}
大家都说,用了Vue后就不用jquery这些了 , 你一下子用了两个(~_~|||)