|
@@ -6,8 +6,10 @@
|
|
|
<van-picker
|
|
|
:columns="columns"
|
|
|
:visible-item-count='3'
|
|
|
+ @change="handlechange"
|
|
|
/>
|
|
|
<div class="confBtn">
|
|
|
+ <p class="tip" v-show="showTip">请选择正确的时间</p>
|
|
|
<div @click="getVal">确认</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -17,8 +19,8 @@
|
|
|
</template>
|
|
|
<script type="text/javascript">
|
|
|
import $ from 'jquery';
|
|
|
- const num = [0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9];
|
|
|
- const unit = ['分钟', '小时', '天', '周', '月','年','分钟', '小时', '天', '周', '月','年','分钟', '小时', '天', '周', '月','年'];
|
|
|
+ const num = [0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9];
|
|
|
+ const unit = ['分钟', '小时', '天', '周', '月','年','分钟', '小时', '天', '周', '月','年'];
|
|
|
export default {
|
|
|
name:'Picker',
|
|
|
data() {
|
|
@@ -40,6 +42,7 @@
|
|
|
defaultIndex: 6
|
|
|
},
|
|
|
],
|
|
|
+ showTip:false
|
|
|
}
|
|
|
},
|
|
|
props:['show'],
|
|
@@ -48,11 +51,19 @@
|
|
|
const val1 = $(".column1 ul .van-picker-column__item--selected")[0].innerText;
|
|
|
const val2 = $(".column2 ul .van-picker-column__item--selected")[0].innerText;
|
|
|
const val3 = $(".column3 ul .van-picker-column__item--selected")[0].innerText;
|
|
|
+ // 如果选两个0,则提示
|
|
|
+ if(val1 == 0 && val2 == 0){
|
|
|
+ this.showTip = true;
|
|
|
+ return
|
|
|
+ }
|
|
|
const value = val1 + val2 + val3;
|
|
|
this.$emit("comfirn",value)
|
|
|
},
|
|
|
onCancel() {
|
|
|
this.$emit("cancel")
|
|
|
+ },
|
|
|
+ handlechange(){//关掉提示
|
|
|
+ this.showTip = false;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -82,6 +93,16 @@
|
|
|
text-align: center;
|
|
|
border-top: 1px solid #ebedf0;
|
|
|
margin-top: 25px;
|
|
|
+ position: relative;
|
|
|
+ .tip{
|
|
|
+ position: absolute;
|
|
|
+ top:-22px;
|
|
|
+ font-size: .12rem;
|
|
|
+ color: red;
|
|
|
+ line-height: 20px;
|
|
|
+ width:100%;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
div{
|
|
|
color: #colors[theme];
|
|
|
}
|