基于vue2.0+vuex的日期选择组件

时间:2025-01-24 16:06:34
<template> <div id="app"> <p @click = "setDate">点击设置日期</p> <!--显示返回的日期--> <p>{{date}}</p> <!--组件--> <com-calendar :style = "calendar" :startTime = "start" :endTime="end"></com-calendar> <!--遮罩--> <div v-show = "mark" class="mark" @ ="" @ ="" @ =""></div> </div> </template> <script> require('./css/'); import calendar from './components/calendar'; export default { name: 'app', data () { return { //选择日期的开始返回,默认是1900 - 2050 start:1950, end:2030 } }, components:{ comCalendar:calendar }, methods:{ setDate:function () { //触发日期组件 this.$('calendarStatus',true); } }, computed:{ //遮罩状态 mark:function () { return this.$ }, //组件状态 calendar:function () { return this.$?{ display:'block'}:{ display:'none'}; }, //返回的日期 date:function () { return this.$; } } } </script>