<template>
  <div id="userProtocol" :class="{ app: true, block: type === 1 }">
    <div class="sk" v-if="!content">
      <br />
      <van-skeleton title :row="10" />
    </div>
    <news v-if="content" :item="{ content: content }" />
  </div>
</template>

<script>
import { Skeleton as vanSkeleton } from "vant";
import { currentUrlToParams } from "@/utils/common.js";
import "vant/lib/skeleton/style";
import news from "@/components/Detail/news.vue";

export default {
  name: "app",
  data: function() {
    return {
      content: "",
      type: undefined
    };
  },
  methods: {
    onClickLeft() {
      history.go(-1);
    }
  },
  mounted() {
    let _this = this;
    window.userProtocol = function(html) {
      _this.content = html;
    };
    this.$pageParams = currentUrlToParams();
    this.type = this.$pageParams.pattern - 0;
  },
  beforeDestroy: function() {},
  components: { news, vanSkeleton }
};
</script>
<style lang="scss">
#userProtocol {
  height: 100%;
  overflow-y: scroll;
  .head {
    text-align: center;
    padding-bottom: 1em;
    padding-top: 0.5rem;
    .van-image {
      margin: 0 auto;
    }
  }
}
</style>
