<template>
<view class="page" :style="{color: fontColor}">
<view class="title" v-if="!isStart">
距离开始:
</view>
<view class="title" v-else>
距离结束:
</view>
<view class="days">
{
{time.day || '00'}}天
</view>
<view class="hour">
{
{time.hour || '00'}}时
</view>
<view class="minutes">
{
{time.min || '00'}}分
</view>
<view class="security">
{
{time.sec || '00'}}秒
</view>
</view>
</template>
<script>
export default {
data () {
return {
time: {},
isStart: false,
}
},
props: {
start_time: String,
end_time: String,
fontColor: String
},
mounted() {
this.countDown()
},
methods: {
timeFormat(param) {
return param < 10 ? '0' + param : param;
},
countDown () {
var interval = setInterval(() => {
// 当前时间