源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

基于vuejs+webpack的日期选择插件

  • 时间:2020-12-12 02:55 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:基于vuejs+webpack的日期选择插件
基于vuejs+webpack环境使用的日期选择插件,希望大家喜欢。 [u][i][b]支持单选和多选日期 支持限定开始和结束日期范围选择。 支持小时分钟 需要引入fontawesome.io 的图标库。[/b][/i][/u] [img]http://files.jb51.net/file_images/article/201611/2016113113601186.gif?201610311369[/img] [b][img]http://files.jb51.net/file_images/article/201611/2016113113631201.gif?2016103113638[/img] [/b] [b]Options [/b] :show 是否显示 :type date|datetime :value 默认值 :begin 可选开始时间 :end 可选结束时间 :x 显示x坐标 :y 显示y坐标 :range 是否多选 test.vue
<template>
 <input type="text" @click="showCalendar" v-model="value" placeholder="请输入日期">
 <calendar :show.sync="show" :value.sync="value" :x="x" :y="y" :begin="begin" :end="end" :range="range"></calendar>
</template>

<script>
module.exports = {
 data: function() {
  return {
   show:false,
   type:"date", //date datetime
   value:"2015-12-11",
   begin:"2015-12-20",
   end:"2015-12-25",
   x:0,
   y:0,
   range:true,//是否多选
  }
 },
 methods:{
  showCalendar:function(e){
   e.stopPropagation();
   var that=this;
   that.show=true;
   that.x=e.target.offsetLeft;
   that.y=e.target.offsetTop+e.target.offsetHeight+8;
   var bindHide=function(e){
    e.stopPropagation();
    that.show=false;
    document.removeEventListener('click',bindHide,false);
   };
   setTimeout(function(){
    document.addEventListener('click',bindHide,false);
   },500);
  }
 },
 components:{
  calendar: require('./calendar.vue')
 }
}
</script>
项目地址: [url=https://github.com/jinzhe/vue-calendar]https://github.com/jinzhe/vue-calendar[/url] 本文已被整理到了《[url=http://www.1sucai.cn/Special/874.htm]Vue.js前端组件学习教程[/url]》,欢迎大家学习阅读。 以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程素材网。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部