我正在Vue.js中构建组件。我在页面上有一个输入,用户可以在其中输入一定的信用额度。目前,我正在尝试创建一个将输入金额记录到控制台的函数,当我键入它时。(最终,我将根据用户输入显示/隐藏所请求的文档。我没有希望他们必须单击“提交”按钮。)
当我在输入字段中使用Tab键/单击时,下面的代码将其记录下来。这是我的component.vue:
<template>
<div class="col s12 m4">
<div class="card large">
<div class="card-content">
<span class="card-title">Credit Limit Request</span>
<form action="">
<div class="input-field">
<input v-model="creditLimit" v-on:change="logCreditLimit" id="credit-limit-input" type="text">
<label for="credit-limit-input">Credit Limit Amount</label>
</div>
</form>
<p>1. If requesting $50,000 or more, please attach Current Balance Sheet (less than 1 yr old).</p>
<p>2. If requesting $250,000 or more, also attach Current Income Statement and Latest Income Tax Return.</p>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'licenserow',
data: () => ({
creditLimit: "" …Run Code Online (Sandbox Code Playgroud)