【发布时间】:2019-12-22 20:20:31
【问题描述】:
将在这里发布我的问题,因为 vue.js 论坛似乎已经死了并且无法收到松弛确认电子邮件。
我最近开始使用 .vue 进行编码并有一个问题。
使用 timepicker 选择时间后,我想将 hour 和 minute 放入一个变量中。 (一个或多个,还不确定) 现在我得到这个“Sun Dec 31 1899 07:25:00 GMT-0500 (EST)”
我以为我能做到
console.log(this.hour);
console.log(this.minute);
console.log(this.hour + ":" + this.minute);
他的代码在这里 https://play.nativescript.org/?template=play-vue&id=pFJlwX&v=4
<template>
<Page>
<ActionBar title="Time Picker" />
<ScrollView>
<StackLayout class="home-panel">
<TimePicker v-model="yourTimeValue" @timeChange="onHour" :hour="8" :minute="currentMinute" minuteInterval="5" />
<TextField v-model="textFieldValue" hint="Enter text..." @returnPress=" onHour" />
</StackLayout>
</ScrollView>
</Page>
</template>
<script>
export default {
data() {
return {
currentMinute: new Date().getMinutes(),
textFieldValue: ""
};
},
methods: {
// when you release your finger from the timepicker, you end up in this function
onHour: function(args) {
console.log(this.yourTimeValue); // returns something like this Sun Dec 31 1899 07:25:00 GMT-0500 (EST)
console.log(this.textFieldValue); // this return the text you wrote in the text field
}
}
};
</script>
<style scoped>
.home-panel {
vertical-align: center;
font-size: 20;
margin: 15;
}
.description-label {
margin-bottom: 15;
}
</style>
谢谢
【问题讨论】:
标签: vue.js nativescript timepicker nativescript-vue