Files
dvcp_v2_webapp/project/pingchang/apps/AppWishfulThinking/AppWishfulThinking.vue
2022-11-15 15:13:48 +08:00

66 lines
1.3 KiB
Vue

<template>
<section class="AppWishfulThinking">
<component ref="component" :is="currentPage" @change="onChange" :params="params" :instance="instance" :dict="dict"/>
</section>
</template>
<script>
import List from './components/List'
import Detail from './components/Detail'
import Add from './components/Add'
import Setting from './components/Setting'
export default {
name: 'AppWishfulThinking',
label: '微心愿',
props: {
instance: Function,
dict: Object
},
data() {
return {
component: 'List',
params: {}
}
},
computed: {
currentPage() {
// let {hash, query: {id}} = this.$route
// return hash == "#Setting" ? Setting :
// !!id ? Detail : List
console.log(this.$route.hash)
if (this.$route.hash == "#add") {
return Add
} else if (this.$route.hash == "#Setting") {
return Setting
} else if (this.$route.query.id) {
return Detail
} else return List
}
},
components: {
List,
Detail,
Add,
Setting
},
methods: {
onChange(data) {
console.log(data)
this.$router.push({query: data.params, hash: data.type})
}
}
}
</script>
<style lang="scss">
.AppWishfulThinking {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
</style>