vue怎么获取input值
v-for里有多行input输入框,vue怎么获取某行的输入的值,ref无法动态绑定id,v-model只有在单行input时有用,多行的时候会全部都改掉,有没有人做过这...
v-for里有多行input输入框,vue怎么获取某行的输入的值,ref无法动态绑定id,v-model只有在单行input时有用,多行的时候会全部都改掉,有没有人做过这样的功能,有很多行的input数据,现在想单独触发某一行的时候获取输入的value,ref能取到value但是无法绑定id去判断,不知道触发的是哪一行
<div v-model="skuList" v-for="(val, key) in skuList ">
<div>
<div>
<span>价格:</span>
<span><input type="text" v-bind:value="val.price" ref="priceRef"></span>
</div>
<div>
<span>上限:</span>
<span><input class="stockTotal" type="text" v-bind:value="val.total" ref="totalRef"></span>
</div>
</div>
</div>
已经解决,用v-model 展开
<div v-model="skuList" v-for="(val, key) in skuList ">
<div>
<div>
<span>价格:</span>
<span><input type="text" v-bind:value="val.price" ref="priceRef"></span>
</div>
<div>
<span>上限:</span>
<span><input class="stockTotal" type="text" v-bind:value="val.total" ref="totalRef"></span>
</div>
</div>
</div>
已经解决,用v-model 展开
1个回答
展开全部
<mt-button size="large" type="green" @click="nextstep">下一步</mt-button>
</div>
</mt-content>
</template>
<script>
import MtContent from '../../components/content'
import MtHeader from '../../components/header.vue'
import MtButton from '../../components/button.vue'
import MtField from '../../components/field.vue'
import $ from 'zepto'
export default{
data () {
return{
msg:'hello vue'
}
},
methods: {
nextstep () {
}
},
components: {
MtContent,
MtHeader,
MtButton,
MtField
</div>
</mt-content>
</template>
<script>
import MtContent from '../../components/content'
import MtHeader from '../../components/header.vue'
import MtButton from '../../components/button.vue'
import MtField from '../../components/field.vue'
import $ from 'zepto'
export default{
data () {
return{
msg:'hello vue'
}
},
methods: {
nextstep () {
}
},
components: {
MtContent,
MtHeader,
MtButton,
MtField
追问
你这是写的啥
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询