# 数据默认值

# 配置方法

配置value为字段默认值

<avue-form :option="option" v-model="form" > </avue-form>

<script>
export default{
  data() {
    return {
      form: {},
      option: {
        column: [
          {
            label: '姓名',
            prop: 'name',
            value:'small'
          }
        ]
      }
    }
  }
}
</script>

Expand Copy

# 赋值方法



利用v-model绑定的对象直接操作即可

<el-button @click="changeText" size="small" type="success">改变值</el-button>
<br/><br/>
<avue-form :option="option" v-model="form" > </avue-form>

<script>
export default{
  data() {
    return {
      form: {
        name:'small'
      },
      option: {
        column: [
          {
            label: '姓名',
            prop: 'name'
          }
        ]
      }
    }
  },
  methods:{
      changeText(){
        this.form.name="我改变了"
      }
  }
}
</script>

Expand Copy
Last Updated: 3/28/2022, 9:38:12 AM