vue中设置时间选择范围
vue源码<script src="//unpkg.com/vue/dist/vue.js"></script><script src="//unpkg.com/iview/dist/iview.min.js"></script><div id="app"><row><i-col s...
·
vue源码
<script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="//unpkg.com/iview/dist/iview.min.js"></script>
<div id="app">
<row>
<i-col span="12">
<date-picker type="date" :options="options3" placeholder="Select date" style="width: 200px"></date-picker>
</i-col>
<i-col span="12">
<date-picker type="date" :options="options4" placeholder="Select date" style="width: 200px"></date-picker>
</i-col>
</row>
</div>
js源码
var Main = {
data () {
return {
options3: {
disabledDate (date) {
return date && date.valueOf() < Date.now() - 86400000;
}
},
options4: {
disabledDate (date) {
const disabledDay = date.getDate();
return disabledDay === 15;
}
}
}
}
}
var Component = Vue.extend(Main)
new Component().$mount('#app')
效果如下:
更多推荐
已为社区贡献2条内容
所有评论(0)