码迷,mamicode.com
首页 > 其他好文 > 详细

父组件向子组件传递数据,子组件展示并更新 element-ui

时间:2020-03-04 14:37:43      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:func   remote   htm   await   -o   展示   选择   pre   apollo   

<el-select v-model="currentAuditProcess" placeholder="请选择"
    @click.native="clickSearchAuditProcessList">
    <el-option v-for="item in auditProcesses"
     :key="item.id" :label="item.name" :value="item.id"></el-option>
 </el-select>

export default Vue.extend({
    props:{
        engineFormData: {}
    },
    data(){
        currentAuditProcess: null,
        auditProcesses: [],
    }

    watch:{
        engineFormData: function (newValue, oldValue) {
                if (newValue){
                    this.auditProcesses = [];
                    this.auditProcesses.push(newValue.audit_process);
                    this.currentAuditProcess =newValue.audit_process.id;

                }
        }
    },
    methods:{
        clickSearchAuditProcessList(){
            this.searchRemoteAuditProcesses();
        },

        async searchRemoteAuditProcesses() {
            const result = (await this.$apollo.query({
                query: AuditProcessList,
                variables: { application: this.application }
            })).data.auditProcessList;
            this.auditProcesses = result.auditProcessList;
        },
    }

})

父组件向子组件传递数据,子组件展示并更新 element-ui

标签:func   remote   htm   await   -o   展示   选择   pre   apollo   

原文地址:https://www.cnblogs.com/jijizhazha/p/12409163.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!