123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- <template>
- <view class="container">
-
- <Page :items="items" />
- </view>
- </template>
- <script>
- import * as Api from '@/api/page'
- import Page from '@/components/page'
- const App = getApp()
- export default {
- components: {
- Page
- },
- data() {
- return {
-
- options: {},
-
- page: {},
-
- items: []
- }
- },
-
- onLoad(options) {
-
- this.options = options
-
- this.getPageData()
- },
- methods: {
-
- getPageData(callback) {
- const app = this
- const pageId = app.options.pageId || 0
- Api.detail(pageId)
- .then(result => {
-
- const { data: { pageData } } = result
- app.page = pageData.page
- app.items = pageData.items
-
- app.setPageBar();
- })
- .finally(() => callback && callback())
- },
-
- setPageBar() {
- const { page } = this
-
- uni.setNavigationBarTitle({
- title: page.params.title
- })
-
- uni.setNavigationBarColor({
- frontColor: page.style.titleTextColor === 'white' ? '#ffffff' : '#000000',
- backgroundColor: page.style.titleBackgroundColor
- })
- }
- },
-
- onPullDownRefresh() {
-
- this.getPageData(() => {
- uni.stopPullDownRefresh()
- })
- },
-
- onShareAppMessage() {
- const app = this
- const { page } = app
- return {
- title: page.params.share_title,
- path: "/pages/index/index?" + app.$getShareUrlParams()
- }
- },
-
- onShareTimeline() {
- const app = this
- const { page } = app
- return {
- title: page.params.share_title,
- path: "/pages/index/index?" + app.$getShareUrlParams()
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- background: #fff;
- }
- </style>
|