我正在使用
https://www.npmjs.com/package/vuejs-datepicker
在我的Laravel 5.7应用程序中。我希望能够根据文档排除一些日期
https://www.npmjs.com/package/vuejs-datepicker#disabled-dates
但是当我在刀片模板中设置脚本配置时,会出现此错误
vendor.js?id=e10b221b3d10c7b9aa8e:1055 [Vue warn]: Error compiling template:
所以我试图将脚本推送到加载了app.js的位置,但是仍然出现相同的错误
这是脚本的样子
<script>
var state = {
disabledDates: {
to: new Date(2016, 0, 5), // Disable all dates up to specific date
from: new Date(2016, 0, 26), // Disable all dates after specific date
days: [6, 0], // Disable Saturday's and Sunday's
daysOfMonth: [29, 30, 31], // Disable 29th, 30th and 31st of each month
dates: [ // Disable an array of dates
new Date(2016, 9, 16),
new Date(2016, 9, 17),
new Date(2016, 9, 18)
],
ranges: [{ // Disable dates in given ranges (exclusive).
from: new Date(2016, 11, 25),
to: new Date(2016, 11, 30)
}, {
from: new Date(2017, 1, 12),
to: new Date(2017, 2, 25)
}],
// a custom function that returns true if the date is disabled
// this can be used for wiring you own logic to disable a date if none
// of the above conditions serve your purpose
// this function should accept a date and return true if is disabled
customPredictor: function(date) {
// disables the date if it is a multiple of 5
if(date.getDate() % 5 == 0){
return true
}
}
}
}
</script>