<template>
<div style="text-align:initial">
    <van-nav-bar title="新闻详情" left-text="返回" left-arrow @click-left="$router.back()" />
    
    <div >

        <div style="text-align: center;font-size: 24px">{{ newsDetail.title }}</div>
        <br>
        <div style="text-align: right;font-size: 10px">
            <span>（发布人：{{ newsDetail.creator }}）</span>
            <span>发布时间：{{ newsDetail.updated_at_datetime }} </span>
        </div>

        <hr>

        <div class="w-e-text" v-html="newsDetail.content"></div>
        <!-- <iframe ref="newsContent" width="100%" style="min-height:500px" id="newsContent" frameborder="0" :srcdoc="newsDetail.content"></iframe> -->


    </div>

</div>
</template>

<script type="text/babel">
import Vue from 'vue';
import { NavBar } from 'vant';

Vue.use(NavBar);
import E from 'wangeditor'
    export default {
        data() {
            return {
                newsDetail: {}
            }
        },
        created(){
            this.userid = localStorage.getItem("userid");
            this.openid = localStorage.getItem("openid");
    
            let id = this.$route.query.id;
            this.getDetail(id);
        },
        methods: {
            getDetail(id) {
                this.$http.get('getNewsDetail&userid=' + this.userid + '&openid=' + this.openid + '&id=' + id)
                    .then(resp => {
                        if (!resp.data.success) {
                            this.$notify(resp.data.message);
                            return;
                        }
                        this.newsDetail = resp.data.data || {};
                    })
                    .catch(() => {
                        this.$notify('出错了')
                    })
            }
        }
    }
</script>
<style scoped>

.editor-content{
    width: 100%;
    height: 100%;
}
</style>