代码规范
This commit is contained in:
@@ -10,7 +10,8 @@
|
||||
:value="momVal"
|
||||
:showTime="true"
|
||||
:format="dateFormat"
|
||||
:getCalendarContainer="getCalendarContainer"></a-date-picker>
|
||||
:getCalendarContainer="getCalendarContainer">
|
||||
</a-date-picker>
|
||||
<!--YYYY-MM-DD-->
|
||||
<a-date-picker
|
||||
v-if="showType === 'day'"
|
||||
@@ -21,7 +22,8 @@
|
||||
:value="momVal"
|
||||
:showTime="false"
|
||||
:format="dateFormat"
|
||||
:getCalendarContainer="getCalendarContainer"></a-date-picker>
|
||||
:getCalendarContainer="getCalendarContainer">
|
||||
</a-date-picker>
|
||||
<!--YYYY-MM-->
|
||||
<a-month-picker
|
||||
v-if="showType === 'month'"
|
||||
@@ -29,7 +31,8 @@
|
||||
:value="momVal"
|
||||
:disabled="disabled || readOnly"
|
||||
:format="dateFormat"
|
||||
@change="handleMonthChange"></a-month-picker>
|
||||
@change="handleMonthChange">
|
||||
</a-month-picker>
|
||||
<!--YYYY-->
|
||||
<a-date-picker
|
||||
v-if="showType === 'year'"
|
||||
@@ -37,12 +40,12 @@
|
||||
mode="year"
|
||||
:format="dateFormat"
|
||||
:value="year"
|
||||
@disabledDate="disabledDate"
|
||||
:disabled="disabled || readOnly"
|
||||
:open="yearShowOne"
|
||||
:getCalendarContainer="getCalendarContainer"
|
||||
@openChange="openChangeOne"
|
||||
@panelChange="panelChangeOne"></a-date-picker>
|
||||
@panelChange="panelChangeOne">
|
||||
</a-date-picker>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@@ -64,12 +67,6 @@
|
||||
default: 'YYYY-MM-DD',
|
||||
required: false
|
||||
},
|
||||
//此属性可以被废弃了
|
||||
triggerChange:{
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
readOnly:{
|
||||
type: Boolean,
|
||||
required: false,
|
||||
@@ -95,8 +92,7 @@
|
||||
let dateStr = this.value;
|
||||
return {
|
||||
yearShowOne:false, //控制年份模态框的显示与否
|
||||
year:'',
|
||||
decorator:"",
|
||||
year:'', // mode==“year” 专用
|
||||
momVal:!dateStr?null:moment(dateStr,this.dateFormat),
|
||||
}
|
||||
},
|
||||
@@ -110,9 +106,6 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
disabledDate(current){
|
||||
return new Date(current._d).setFullYear((new Date(current._d).getFullYear())) < new Date(moment()._d).setFullYear((new Date(moment()._d).getFullYear() - 1))
|
||||
},
|
||||
moment,
|
||||
handleDateChange(mom,dateStr){
|
||||
this.$emit('change', dateStr);
|
||||
@@ -120,9 +113,11 @@
|
||||
handleMonthChange(mom,dateStr){
|
||||
this.$emit('change',dateStr)
|
||||
},
|
||||
// 弹出日历和关闭日历的回调
|
||||
/**
|
||||
* 弹出日历和关闭日历的回调
|
||||
* status:打开或关闭的状态
|
||||
* */
|
||||
openChangeOne(status){
|
||||
//status是打开或关闭的状态
|
||||
this.yearShowOne = status
|
||||
},
|
||||
// 得到年份选择器的值
|
||||
@@ -133,15 +128,10 @@
|
||||
this.$emit('change',year)
|
||||
}
|
||||
},
|
||||
//2.2新增 在组件内定义 指定父组件调用时候的传值属性和事件类型 这个牛逼
|
||||
//2.2新增 在组件内定义 指定父组件调用时候的传值属性和事件类型
|
||||
model: {
|
||||
prop: 'value',
|
||||
event: 'change'
|
||||
}
|
||||
}
|
||||
// let bodyO = document.querySelector()
|
||||
// bodyO.onclick = function (){
|
||||
// console.log(0)
|
||||
// }
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user