2019.1.28(1)-- vue的scrollBehavior 和 日历插件
vue scrollBehavior
刷新浏览器会发现滚动条依然在原来的位置,这是浏览器的默认行为,会记录浏览器滚动条默认位置。
在index.js中
scrollBehavior (to, from, savedPosition) {
// return 期望滚动到哪个的位置
if (savedPosition) {
return savedPosition
}
else {
return { x: 0, y: 0 }
}
移动端calendar mobiscroll
$("#test-calendar").val(this.getdate())
$("#test-calendar").mobiscroll().calendar({
theme: "mobiscroll",
lang: "zh", //使用语言
display: "bottom",// 在底部显示
dateFormat: "yy-mm-dd", // 日期格式
onClose: function (event, inst) {
that.$http({ //onclose:关闭时获取数据
method: "get",
url: "",
params: {
userId: that.userId,
time: inst._tempValue
}
})
}
});
getdate() {
var date = new Date();
var seperator1 = "-";
var year = date.getFullYear();
var month = date.getMonth() + 1;
var strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var currentdate = year + seperator1 + month + seperator1 + strDate;
return currentdate;
}