浏览代码

card支持换行与空格(取消默认首行缩进)

napier 2 年之前
父节点
当前提交
0527f05eee
共有 3 个文件被更改,包括 31 次插入18 次删除
  1. 17 7
      src/components/card.vue
  2. 0 2
      src/components/map.vue
  3. 14 9
      src/components/mobileBar.vue

+ 17 - 7
src/components/card.vue

@@ -12,7 +12,7 @@
       <div class="background">
         <div class="title" id="title">{{ title | ellipsis_title}}</div>
 <!--        <div class="bottom clearfix">-->
-          <div class="info" id="info">{{ info | ellipsis_info}}</div>
+          <div class="info" id="info" style="white-space: pre-wrap;" >{{ info | ellipsis_info}}</div>
 <!--        </div>-->
         <!-- <button id="button-show-all" class="button-show-all" onclick="">{{ '阅读全文' }}</button> -->
       <a
@@ -90,10 +90,20 @@ export default {
     closeCard () {
       bus.$emit('closePopup')
     },
-    // fixText () {
-    //   var text = this.info.replace(/\n/g, '<br/>' + '        ')
-    //   this.info = text
-    // },
+
+
+    fixText () {
+      // var text = this.info.replace(/\n/g, '<br/>' + '        ')
+      // this.info = text
+
+
+      // var str = this.info
+      // var reg=new RegExp("\n","g")
+      // var reg1=new RegExp(" ","g")
+      // str = str.replace(reg,"<br/>")
+      // str = str.replace(reg1,"<p/>")
+      // this.info = str
+    },
 
     /**
      * @description:根据设备动态设置内部尺寸(移动端)
@@ -279,7 +289,7 @@ export default {
     color: black;
     vertical-align: top;
     /*overflow: hidden;*/
-    text-indent: 30px;
+    /* text-indent: 30px; */
     overflow-y:scroll
   }
 
@@ -373,7 +383,7 @@ export default {
     margin-top: 4px;
     margin-right: 12px;
     margin-left: 12px;
-    text-indent: 15px;
+    /* text-indent: 15px; */
     width: 216px;
     height: 68px;
     font-size: 11px;

+ 0 - 2
src/components/map.vue

@@ -467,8 +467,6 @@ export default {
           style = this.otherStyles
           break
       }
-      console.log(type)
-      console.log(type + ':' + style)
       var feature = this.GeoJSON_to_Feature(geometry, style)
 
       // 要素属性装载

+ 14 - 9
src/components/mobileBar.vue

@@ -88,10 +88,6 @@
 
           <!-- 标签栏(按钮) -->
           <div style="text-align:center; margin-bottom: 10px" id='list-btn-div'>
-            <!-- <b-button size="sm" pill variant="outline-success" @click="getNoticeList()">通知</b-button>
-            <b-button size="sm" pill variant="outline-success" @click="getReportList()">报道</b-button>
-            <b-button size="sm" pill variant="outline-success" @click="getCultureList()">文化</b-button>
-            <b-button size="sm" pill variant="outline-success" @click="getOthersList()">更多</b-button> -->
             <b-form-radio-group
               id="btn-radios-2"
               v-model="selected"
@@ -236,7 +232,7 @@ export default {
       this.$axios
         .get('/notice/list')
         .then(function (response) {
-          that.listData.notice = response.data
+          that.listData.notice = response.data.sort(that.compare('level'))
           // 浅拷贝到当前的通知列表数组
           that.listData.current = JSON.parse(JSON.stringify(that.listData.notice))
           that.currentMsgType = 'notice'
@@ -252,7 +248,7 @@ export default {
       this.$axios
         .get('/report/list')
         .then(function (response) {
-          that.listData.report = response.data
+          that.listData.report = response.data.sort(that.compare('level'))
           // 浅拷贝到当前的通知列表数组
           that.listData.current = JSON.parse(JSON.stringify(that.listData.report))
           that.currentMsgType = 'report'
@@ -267,7 +263,7 @@ export default {
       this.$axios
         .get('/culture/list')
         .then(function (response) {
-          that.listData.culture = response.data
+          that.listData.culture = response.data.sort(that.compare('level'))
           // 浅拷贝到当前的通知列表数组
           that.listData.current = JSON.parse(JSON.stringify(that.listData.culture))
           that.currentMsgType = 'culture'
@@ -282,13 +278,22 @@ export default {
       this.$axios
         .get('/others/list')
         .then(function (response) {
-          that.listData.others = response.data
+          that.listData.others = response.data.sort(that.compare('level'))
           // 浅拷贝到当前的通知列表数组
           that.listData.current = JSON.parse(JSON.stringify(that.listData.others))
-          that.currentMsgType = 'other'
+          that.currentMsgType = 'others'
         })
     },
 
+    // 比较重要级 property:为比较的字段 代码修改
+    compare(property){
+      return function(a,b){
+          var value1 = a[property];
+          var value2 = b[property];
+          return value2 - value1 ;
+      }
+    },
+
     // 按钮点击事件,更新列表
     updateList: function (value) {
       switch (value) {