Browse Source

bug修改

sunran 3 years ago
parent
commit
5930321eae
2 changed files with 16 additions and 7 deletions
  1. 1 1
      src/views/zhulao/App.vue
  2. 15 6
      src/views/zhulao/views/home/newsDetails.vue

+ 1 - 1
src/views/zhulao/App.vue

@@ -22,7 +22,7 @@ export default {
   -webkit-font-smoothing: antialiased;
   -moz-osx-font-smoothing: grayscale;
   color: #2c3e50;
-  height: 100%;
+  min-height: 100%;
 }
 
 #nav {

+ 15 - 6
src/views/zhulao/views/home/newsDetails.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="main">
-    <van-nav-bar title="资讯详情" @click-left="$router.back()" left-arrow fixed placeholder safe-area-inset-top />
-    <div class="contentHtml" v-html="content"></div>
+    <van-nav-bar ref="navbar" title="资讯详情" @click-left="$router.back()" left-arrow fixed placeholder safe-area-inset-top />
+    <div class="contentHtml" :style="{height:height+'px'}" v-html="content"></div>
   </div>
 </template>
 <script>
@@ -11,15 +11,22 @@ export default {
   data() {
     return {
       content: '',
+      height: '100%',
     }
   },
+  mounted() {
+    window.scrollTo(0, 0)
+    var navbarheight = this.$refs.navbar.height
+    this.height = document.documentElement.clientHeight - navbarheight - 10
+    console.log(navbarheight)
+  },
   created() {
     this.id = this.$route.query.id
     this.getArticleMessage()
   },
-  methods: { 
+  methods: {
     async getArticleMessage() {
-      const res = await serverAPI('zpsmzxxqjk',{ id: this.id })
+      const res = await serverAPI('zpsmzxxqjk', { id: this.id })
       this.content = res.data.content
     },
   },
@@ -27,9 +34,10 @@ export default {
 </script>
 <style lang="scss" scoped>
 .main {
+  height: 100%;
   padding: 0 30px;
   font-size: 24px;
-  padding-bottom: 30px;
+  //   padding-bottom: 30px;
   ::v-deep p {
     margin: 0 !important;
     padding: 0 !important;
@@ -38,7 +46,8 @@ export default {
 </style>
 <style lang="scss">
 .contentHtml {
-  overflow: hidden;
+  overflow-x: hidden;
+  overflow-y: auto;
   img {
     max-width: calc(100% - 60px);
     height: auto;