vue 取到v-decorator的值,並使用v-if渲染表單其他組件


<a-form :form="form">
  <a-form-item
    :labelCol="labelCol"
    :wrapperCol="wrapperCol"
    label="商品類型">
    <j-dict-select-tag v-decorator="['type', validatorRules.type]" placeholder="請選擇商品類型" dictCode="product_type"
                       :trigger-change="true" @change="getType"/>
<a-row style="margin:0px 0px 20px 0px" v-if="productType == 'pro'">
  <a-col :span="16" :offset="5">
    <a-button type="primary" @click="showProductModal">
      選擇商品
    </a-button>
    <!-- 商品分頁選擇表單區域 -->
    <product-type-modal ref="modalForm" @ok="modalFormOk" :app-id="appId"></product-type-modal>
  </a-col>
</a-row>
<a-row style="margin:0px 0px 20px 0px" v-else-if="productType != ''&& productType!='pro' && productType != undefined">
  <a-col :span="16" :offset="5">
    <a-button type="primary" @click="showServiceModal">
      選擇業務包
    </a-button>
    <!-- 業務包分頁選擇表單區域 -->
    <service-type-modal ref="modalServiceForm" @ok="modalServiceFormOk"></service-type-modal>
  </a-col>
</a-row>
在方法里,

//當切換商品類型的時候,得到他的值
getType() {
    this.$nextTick(() => {
        console.log('form:{}', this.form.getFieldValue('type'));
        this.productType = this.form.getFieldValue('type')
    });
},

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM