先提交一波整理的代码
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
<template>
|
||||
<section class="AppOrganizationChange">
|
||||
<keep-alive :include="['List']">
|
||||
<component ref="component" :is="component" :instance="instance" :selected.sync="selected" :params="params" :dict="dict" @change="onChange"/>
|
||||
<component :is="currentPage" :instance="instance" :selected.sync="selected" :params="params" :dict="dict" @change="onChange"/>
|
||||
</keep-alive>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapState} from "vuex";
|
||||
import addChange from "./components/addChange.vue";
|
||||
import List from "./components/List.vue";
|
||||
import organizationSetting from "./components/organizationSetting.vue";
|
||||
@@ -19,10 +20,20 @@ export default {
|
||||
dict: Object,
|
||||
},
|
||||
components: {
|
||||
List,
|
||||
List,
|
||||
addChange,
|
||||
organizationSetting,
|
||||
},
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
currentPage() {
|
||||
if (this.$route.hash == "#add") {
|
||||
return addChange
|
||||
} else if (this.$route.hash == "#setting") {
|
||||
return organizationSetting
|
||||
} else return List
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
component: "List",
|
||||
@@ -33,26 +44,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
onChange(data) {
|
||||
if (data.type === "List") {
|
||||
this.component = "List";
|
||||
this.params = data.params;
|
||||
}
|
||||
|
||||
if (data.type === "organizationSetting") {
|
||||
this.component = "organizationSetting";
|
||||
this.params = data.params;
|
||||
}
|
||||
|
||||
if (data.type === "addChange") {
|
||||
this.component = "addChange";
|
||||
this.params = data.params;
|
||||
|
||||
this.$nextTick(() => {
|
||||
if (data.isRefresh) {
|
||||
this.$refs.component.getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
this.params = data.params;
|
||||
},
|
||||
},
|
||||
created() {
|
||||
|
||||
Reference in New Issue
Block a user