<template>
<view>
<block v-for="(item,index) in inputData" :key="index">
<i-input :name='item.name' :title="item.title" :icon='item.icon' v-model="f[item.name]" :error="error[item.name]">
<button v-if="index==2" class="cu-btn round bg-green" @click="openWin(index)">验证码</button>
</i-input>
</block>
<i-input name='4name' title="测试" icon='cuIcon-phone text-blue' v-model="f.tel" :error="error.tel">
<button class="cu-btn round bg-green" @click="openWin(index)">验证码</button>
</i-input>
</view>
</template>
<script>
import iInput from "@/components/mi/form/iInput.vue";
import formGroup from "@/components/mi/form/formGroup.vue";
export default {
data() {
return {
f: {
name: '',
tel: '',
add: '中国'
},
error: {
name: '',
tel: '',
add: ''
},
inputData: [{
name: 'name',
icon: 'cuIcon-people text-blue',
title: '姓名'
}, {
name: 'tel',
icon: 'cuIcon-phone text-blue',
title: '电话'
},
{
name: 'add',
icon: 'cuIcon-location text-blue',
title: '家庭住址'
}
]
}
},
created() {
// console.log('启动了')
// 初始值根据后端提供值赋值示例
},
methods: {
openWin(value) {
//打开规则或协议页
console.log('this.error',value)
this.$set(this.error, 'name', '端午节福利')
}
},
components: {
iInput,
formGroup
}
}
</script>
3***@qq.com
- 发布:2019-06-05 10:59
- 更新:2019-06-05 14:21
- 阅读:1978
v-model 循环里绑定变量 报错
分类:uni-app