<template>
<view class="content">
<view>{{toHourMinute(duration)}}</view>
</view>
</template>
<script>
export default {
data() {
return {
duration:100 // 分钟数
}
},
onLoad() {
console.log(this.toHourMinute(this.duration))
},
methods: {
toHourMinute(minutes){
let text = ''
if(Math.floor(minutes/60)==0){
text=(minutes%60) + "分钟"
}else if((minutes%60)==0){
text =Math.floor(minutes/60) + "小时"
}else{
text = (Math.floor(minutes/60) + "小时" + (minutes%60) + "分" )
}
return text
},
}
}
</script>
<style scoped lang="less">
</style>
如有不懂得地方请留言或者私信我