<template>
    <div class="page-cell">
        <co-header title="网络">
            <a @click="goBack()" slot="left">
                <co-button icon="back"></co-button>
            </a>
        </co-header>
        <div class="wrapper">
            <co-cell @click.native="requestAjax()" title="网络请求"></co-cell>
            <co-cell to="detail"
                     v-for="l in list"
                     :key="l.nid"
                     :title="l.title">
            </co-cell>
        </div>
    </div>
</template>
<style>
</style>
<script>
  export default {
    data() {
      return {
        list: []
      };
    },
    methods: {
      goBack: function() {
        history.go(-1);
      },
      requestAjax: function() {
        let me = this;
        corNative.requestAjax({
          url: 'https://news.baidu.com/news?tn=bdapibaiyue&t=newchosenlist',
          method: 'post',
          data: {
            mid: 'EAFAA319E74A53774BD52C36F1B3526A%3AFG%3D1',
            cuid: '',
            ln: '18',
            wf: '0',
            action: '1',
            down: '1',
            display_time: '0',
            withtoppic: '1',
            orientation: '1',
            from: 'news_webapp',
            pd: 'webapp',
            os: 'iphone',
            nids: '',
            remote_device_type: '1',
            os_type: '1',
            screen_size_width: '320',
            screen_size_height: '537'
          }
        }, function(data) {
          me.list = data.data && data.data.news;
        });
      }
    }
  };
</script>

