iview 父组件动态传值给子组件
2024-08-26 03:28:47
父组件
<maintenance-super :show="{'modalSuper':modalSuper,'myData':myData}" @on-close="closeModal" ></maintenance-super>
父组件
<maintenance-super :show="{'modalSuper':modalSuper,'myData':myData}" @on-close="closeModal" ></maintenance-super>
export default {
components: { MaintenanceSuper},
data() {
return {
value:{
telephone:null,
},
myData: {
pageNum: 1,
pageSize: 10,
total: 0,
userModel: {
id: null,
account: null,
director: null, //负责人
}
},
}
子组件
<template>
<div>
<!-- =================== 管理员:表格 =================================== -->
<Modal :title="title" v-model="modalSuper" width="800" :closable="false" @on-hide="hide">
<Table border :columns="superColumns" :data="superData">
<template slot-scope="{ row, index }" slot="action">
<Button type="primary" size="small" @click="restPassWordInfo(row,index)">重置密码</Button>
<Button type="error" size="small" @click="disableAccount(row,index)">警用</Button>
</template>
</Table>
<!-- ======================= 分页 ==================================== -->
<Page
:total="superForm.total"
:current="superForm.pageNum"
:page-size="superForm.pageSize"
@on-change="handlePageSuper"
@on-page-size-change="handlePageSizeSuper"
class="tablePage"
/> <div style="text-align: right;margin-top: 10px;">
<Button @click="handleResetSuper('searchData')">取消</Button>
<Button icon="md-add" type="primary" @click="toSuperModalAdd">新建管理员账户</Button>
</div>
<div slot="footer"></div>
</Modal>
</div>
</template>
props:['show','myData'],
watch: {
show(validate) {
console.log(validate,'1')
if (validate.modalSuper == true) {
this.modalSuper = validate.modalSuper;
this.getTableDataPage();
}
}
传值给父,弹框关闭
handleResetSuper(name) {
// this.modelSuperAdd = false;
// this.$refs[name].resetFields();
this.modalSuper = false;
this.$emit("on-close", false);
},
onClose() {
this.$emit("on-close", false);
},
父组件接收到子组件的传值
methods: {
closeModal(newVal) {
this.modalSuper = newVal;
}
}
最新文章
- 第五次团队作业——第一次项目冲刺——Alpha版本
- 从零自学Hadoop(15):Hive表操作
- [.NET]二维码生成
- 一个多重阴影的DIV框框
- 移动安全初探:窃取微信聊天记录、Hacking Android with Metasploit
- api将一统江湖,再无app
- java的基本程序设计之个人总结要点
- 64位WIN7下安装MPICH2
- [.net 面向对象编程基础] (18) 泛型
- UIView 的属性opaque详解
- mysql重点--执行计划
- eclipse下的Tomcat安装与web项目 搭建
- 复习知识点:XML解析数据,JOSN解析数据,GET请求数据,POST请求数据
- Drupal 7 模 .info 文件描述
- vue的ajax请求之axios
- gitlab 存储仓库目录设置及数据迁移
- djang-rest-framework学习-day1
- sql 根据另一个表的数据更新当前表
- 原理分析之一:从JDBC到Mybatis
- less使用总结