button - Vue使用按钮更改输入字段中的文本
问题描述
我在更改输入文本字段中的文本时遇到问题。我想让用户使用“开始”按钮来启动我的应用程序:当用户单击提交时,这应该在文本字段中写入小时和分钟,并且对于“结束”按钮也是如此。这些时间和其他时间将在火力基地上开火。感谢您的帮助,这是我的代码:
<template>
...
<label>Start Time:</label>
<input type="text" v-model="newAct.startTime" disabled/><br>
<label>End Time:</label>
<input type="text" v-model="newAct.endTime" disabled/><br>
<button @click="submitStart">Start</button>
<button @click="submitEnd">Stop</button>
...
</template>
有我的代码:
<script>
...
export default {
...
submitStart() {
let t = new Date();
let time = t.getHours() + ":" + t.getMinutes();
newAct.StartTime = time;
},
submitEnd() {
let t = new Date();
let time = t.getHours() + ":" + t.getMinutes();
newAct.EndTime = time;
}
}
...
</script>
解决方案
推荐阅读
- javascript - javascript不按设置顺序添加/删除div
- linux - Linux 安装 libX11-devel
- java - @TestPropertySource - 值未从测试属性文件设置/设置为空
- c# - 使用 Visual Studio 2017 在我的第一个应用程序中构建应用程序错误 XamlG 和 Bundle
- python - Python中的子进程超时
- x86 - 不支持 SSSE3 指令的最新处理器?
- php - 将代码从 foreach 重构为 Laravel 集合
- python - 正则表达式替换除小写字母、数字字符、下划线和破折号以外的所有内容
- r - 在箱线图中突出显示特定基因
- python - 我正在尝试使用 python-docx 将表从一个 word 文件 (.docx) 复制到另一个