<div id="app">
<date-picker type="date" :options="options4" format="yyyy/MM/dd" placeholder="选择时间" style="width: 200px" v-model="TableInfo.F_FoShiDate" ></date-picker>
</div>
vm = new Vue({
el: '#app',
data() {
return {
options4: {
//设置不可选日期
disabledDate(date) {
var myDate = new Date();
myDate.setDate(myDate.getDate() + 7);
var disables = date && date.valueOf() < myDate;
//设置后七天往前的时间都不可选
if (disables) {
const disabledDay = date.getDate();
return disabledDay === disabledDay;
} else {
//七天后的日期中,某些日期也不可选
var FaHuiListStr = '@ViewBag.FaHuiList';
if (FaHuiListStr.length > 3) {
FaHuiListStr = FaHuiListStr.replace(/'/g, '"');
var FaHuiList = JSON.parse(FaHuiListStr);
for (var i = 0; i < FaHuiList.length; i++) {
if (date.valueOf() >= new Date(FaHuiList[i].F_FaHuiStartDate).getTime() && date.valueOf() <= new Date(FaHuiList[i].F_FaHuiEndDate).getTime()) {
const disabledDay = date.getDate();
return disabledDay === disabledDay;
}
}
}
}
}
},
TableInfo: {
realname: '',
F_Type: '',
F_FoShiDate: '',
F_FoShiDateTemp: '', //用户修改页面 记录原先选中日期
F_Cause: '',
F_MasterCount: 0,
F_Money: 0,
F_ContentType: '',
F_Contacts: '',
F_ZhiFuLuWei: '',
F_Remarks: '',
F_FoShiTime: '',
},
}
}
});