<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') }); },