用父子组件传值的方法写一个时间选择器的公共组件的方法
由于之前小程序里面用到很多同样的时间筛选器,近期改bug的时候就体会到了没有用公共组件的痛苦,代码量多,修改的地方较多比较麻烦,所以就封装了一个时间选择器公共方法。
时间选择器的功能是
1.默认选中今天和上个月的今天
2.时间选择框相差的时间不超过一年
3.开始时间不能大于结束时间
利于了vue父子组件传值的方法
父组件接收到的,这里的:hello=‘hello’ :hi='hi’是父组件往子组件内传送的值
子组件利用props来接收
点击搜索就成功的接收到值了
以下是代码
<template>
<div>
<view class="seach_demo">
<view class="seach_box">
<view class="serch-info-a">
<view class="uni-list-cell">
<view class="uni-list-cell-left">
开始:
</view>
<view class="uni-list-cell-db">
<picker mode="date" :value="date" :end="endDate" @change="bindDateChange">
<view class="uni-list-cell-data">
<!-- <image src="../../../static/mine/mine-arrow.png" mode="