文本字段有点像这样:
<v-text-field v-model="input" placeholder="(0 - 200)">
</v-text-field>
Vue.js data
包含:
export default {
data () {
return {
input: '',
proposed: 0
}
}
}
我希望占位符显示如下内容:
placeholder="Proposed quantity: 2 (0 - 200)"
尝试通过以下方式设置proposed
变量:
a) placeholder="Proposed quantity: {proposed} (0 - 200)"
b) placeholder="Proposed quantity: `${proposed}` (0 - 200)"
c) placeholder="Proposed quantity: " + proposed + " (0 - 200)"
没有一个起作用。
还有其他想法和建议吗?
答案 0 :(得分:2)
您必须使用placeholder
或:
将v-bind:placeholder ...
绑定到数据对象,如:
:placeholder="'Proposed quantity: '+proposed+ ' (0 - 200)'"
或
v-bind:placeholder="'Proposed quantity: '+proposed+ ' (0 - 200)'"