Ant-design-vue: Input输入组件设置v-decorator后不能使用默认值

Created on 28 Jan 2019  ·  11Comments  ·  Source: vueComponent/ant-design-vue

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.3.3

Environment

mac 10.14,chrome 71.0.3578.98,vue 2.5.17

Reproduction link

Edit on CodeSandbox

Steps to reproduce

输入框使用v-decorator不能设置输入框的默认值

What is expected?

What is actually happening?

Most helpful comment

已经换成 elementui,一路顺畅,毫无违和感。

All 11 comments

@qq447665722 我项目采用typescript 使用@Component装饰组件 组件内使用v-decorator指令后,input输入框不能输入东西是什么问题??

foreach list 到多个表单的时候,list 里面的对象item怎么 通过v-decorator映射到字段 ?

<a-card v-for="item in items">
    <a-form>
           <a-form-item>
               <a-input v-decorator="['item.name']">          //just not working.
           </a-form-item>
    </a-form>
</a-card>

@qq447665722 我项目采用typescript 使用@component装饰组件 组件内使用v-decorator指令后,input输入框不能输入东西是什么问题??

我也遇到同样的问题了,文本框不能输入,有什么方法解决吗?

@wwwwwwwwwy
方便贴下代码吗?

已经换成 elementui,一路顺畅,毫无违和感。

@wwwwwwwwwy
方便贴下代码吗?

<template>
  <a-form class="createleft" :form="form">
    <a-form-item label="文本信息">
      <a-input v-decorator="[
      'username'
      ]" />
    </a-form-item>
  </a-form>
</template>

<script lang="ts">
import { Vue, Component } from "vue-property-decorator";
@Component({})
export default class demo extends Vue {
  form = this.$form.createForm(this);
}
</script>

@wwwwwwwwwy 我也是typescript遇到这个问题,求指点

v-decorator="[loadNum[${index}]

这样可以拿到。
this.form.validateFields()
拿到value后遍历那个数组。
data.push(value.loadNum[index])

我也遇到同样的问题了。
“目测问题是 @component 的问题,虽然我不清楚你怎么用的,解决方案:createForm放在created声明周期中“
上面的作者的的回复,
created() {
this.form = this.$form.createForm(this);
}
改成这样就解决了

@sunny920406 是的,就是这样解决的

Was this page helpful?
0 / 5 - 0 ratings

Related issues

li-xiaoyin picture li-xiaoyin  ·  3Comments

yiptsangkin picture yiptsangkin  ·  3Comments

fengqinglingyu picture fengqinglingyu  ·  5Comments

YingZzz picture YingZzz  ·  4Comments

miyukoarc picture miyukoarc  ·  3Comments