Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.0k views
in Technique[技术] by (71.8m points)

动态添加数据,新增一项之后下拉功能就不管使了。

新增时第一条数据的下拉菜单是管用的,再次新增之后全部的下拉菜单就变成了点击没有任何效果,也不报错,这部分的新增和删除都可以用,但是下拉菜单就成了没有用的功能了。
ded3902f328e512ae5721dd1ea269d6.png

只有一条数据时是可以出现下拉菜单的
image.png

<a-form-model-item label="联络线" prop="rowList">
        <a-row class="row-list" v-for="(item,i) in form.rowList" :key="i">
          <a-col :span='10'>
            <a-select v-model="item.exRegion" placeholder="please select your zone">
              <a-select-option v-for="(value, key) in tie_line_dev" :key="key" :value="key">
                {{value}}
              </a-select-option>
            </a-select>
          </a-col>
          <a-col :span='1'></a-col>
          <a-col :span='10'>
            <a-select v-model="item.mainRegion" placeholder="please select your zone">
              <a-select-option v-for="(value, key) in pwrgrid_dict" :key="key" :value="key">
                {{value}}
              </a-select-option>
            </a-select>
          </a-col>
          <a-col>
            <!-- <a-icon type="plus" /> -->
            <a-icon v-if="form.rowList.length > 1" @click="removeDomain(i)" style="margin-left: 12px;" type="minus-circle-o" />
          </a-col>
        </a-row>
      </a-form-model-item>
      <a-form-model-item>
        <a-button type="dashed" style="width: 100%; margin-left:18%;" @click="addDomain">
          <a-icon type="plus" /> 增加联络线
        </a-button>
      </a-form-model-item>
// data
form: {
    resource: "",
    rowList: [
      {
        exRegion: '',
        mainRegion: '',
      },
    ],
},

// 添加
addDomain() {
  this.form.rowList.push({
    exRegion: '',
    mainRegion: '',
  })
}      
      

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...