<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<!-- <script src="https://unpkg.com/vue/dist/vue.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
</head>
<style>
[v-cloak] {
display: none;
}
</style>
</head>
<body>
<div id="app" v-cloak>¥{{msg}}元
<div>{{testContent}}</div>
</div>
<script>
new Vue({
el: '#app',
data: {
testContent: '',
msg: '100',
toDay: '2023-01-09',
emailList: [
{
startTime: '11:10:20',
endTime: '16:10:20'
}
]
},
mounted() {
this.timeStamp(this.emailList[0].startTime, this.emailList[0].endTime)
},
methods: {
//
timeStamp(startTime, endTime) {
const startTime1 = Date.parse(this.toDay.replace(/-/g, '/') + " " + startTime);
const endTime1 = Date.parse(this.toDay.replace(/-/g, '/') + " " + endTime);
const currentTime = Date.now();
this.testContent = `: startTime1: ${startTime1}| ${this.toDay + " " + startTime} | endTime1: ${endTime1}| ${this.toDay + " " + endTime} | currentTime: ${currentTime} `
}
}
})
</script>
</body>
</html>