微心愿
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user