// index.js
// 获取应用实例
const app = getApp()
import {
  VueLikePage
} from '../../utils/page'

import { CDN_URL } from '../../config/index'

import Router from '../../utils/routes'

let DEMO = [
  {
    name:'诸葛亮',
    id:'1'
  },
  {
    name:'关羽',
    id:'2'
  },
  {
    name:'赵云',
    id:'3'
  },
  {
    name:'曹操',
    id:'4'
  },
  {
    name:'吕布',
    id:'5'
  },
  {
    name:'蔡文姬',
    id:'6'
  },
]

VueLikePage([],{
  data:{
    cdn_url:CDN_URL,
    bg:CDN_URL+'/images/bg@2x.png',
    demo:DEMO,
    showDemo:false,
    isBigScreen:app.globalData.deviceInfo.screenWidth>320
  },
  methods:{
    onLoad:function () {
      wx.hideHomeButton()
    },
    toggleDemo(){
      this.setData({
        showDemo: !this.data.showDemo
      })
    },
    toDemo(e){
        const { id,name } = e.currentTarget.dataset
        Router.push({
            url: 'example',
            query: {
              id,
              name
            }
        })
        
    }
  }
})

