【发布时间】:2021-04-17 12:34:51
【问题描述】:
这是我的代码 sn-p。
<template>
<b-form-input
type="text"
name="title"
class="form-control"
placeholder="Post Title"
@update="onUpdate"
/>
</template>
<script>
export default{
methods:{
onUpdate(value) {
console.log(value)
}
}
}
</script>
当我试图使更新函数内联时:
<b-form-input
type="text"
name="title"
class="form-control"
placeholder="Post Title"
@update="()=>{console.log(value)}" //which is wrong
/>
什么是正确的格式?提前致谢!
CodeSandbox 游乐场: https://codesandbox.io/s/mystifying-benz-w8wgu?file=/src/FormFields.vue
【问题讨论】:
-
试试 //@change 或 @input
-
考虑@update 是强制的情况
标签: vue.js vuejs2 bootstrap-vue