vue 父组件传值给子组件 子组件的销毁与重置 外部调用自己的函数
<rolesadd @my-event="addRoles = false" :IsOfficial="IsOfficial"></rolesadd>// 父组件:IsOfficial子组件接收值IsOfficial要传的值props: {IsOfficial: Boolean,},<el
·
<rolesadd @my-event="addRoles = false" :IsOfficial="IsOfficial"></rolesadd>
// 父组件 :IsOfficial 子组件接收值 IsOfficial 要传的值
props: {
IsOfficial: Boolean,
},
<el-checkbox v-if="IsOfficial==true">是否开放</el-checkbox>
// 子组件 在props里放要取的值 后面是类型 就可以直接使用了
普通类型:字符串(String)、数字(Number)、布尔值(Boolean)、空(Null)
引用类型:数组(Array)、对象(Object)
<companychange @my-event="changeCompany = false" :IsOfficial="IsOfficial" v-if="hackReset" ></companychange>
// 加个if判断
// 在事件中先false 在true就行了
hackReset(that);
window.hackReset=function(that){ // 组件销毁重置功能
that.hackReset = false;//销毁组件
that.$nextTick(() => {
that.hackReset = true
})
}
function ajaxGet2 (that, myUrl, data, callback){
that.$http.get(url + myUrl, { params: data, headers: headers }).then(response => { //用于读取类型与请求方式
if (typeof (response) != "undefined") {
callback(response);
console.log(headers);
}
});
}
export { //很关键
ajaxGet2
}
// 释放
import {ajaxGet2} from '@/js/my.js'
// 引入
更多推荐
已为社区贡献3条内容
所有评论(0)