<template>
  <view class="pageBox">
    <dynamicComponent_page 
      v-if="render"
      :page="_PAGE"
      @goto_page="(e:any)=>goto_page(e)"
    />
  </view>
</template>

<script setup lang="ts">
import { ref, reactive, computed, onBeforeMount, onMounted, onUnmounted, watch, nextTick, onBeforeUnmount } from 'vue'
import { onLoad,onBackPress } from '@dcloudio/uni-app'
import { ConfigStore } from './stores/ConfigStore'

// store
const store_config = ConfigStore()
const _PAGE = <any>ref('')
const render = <any>ref(false)
onLoad((option:any)=>{
  let page_code = option.page_code
  for(let page of store_config.pages){
    if(page.page_code == page_code){
      _PAGE.value = page
      uni.setNavigationBarTitle({
        title:page.page_name
      })
      render.value = true
      break
    }
  }
})

onBeforeMount(async() => {
})
onMounted(()=>{
})
onUnmounted(() => {
})
onBackPress(()=>{
})


// 页面跳转
const goto_page = ({page_code,}:any) => {
  uni.navigateTo({
    url: `/common/views/pages/dynamic/child?page_code=${page_code}`,
  })
}


</script>

<style lang="scss">
.pageBox{
  background: #eaf1f7;
}
</style>
