Browse Source

title换行

yangc 8 years ago
parent
commit
4edd1f3fef
1 changed files with 15 additions and 4 deletions
  1. 15 4
      components/product/component/ComponentDetail.vue

+ 15 - 4
components/product/component/ComponentDetail.vue

@@ -68,8 +68,8 @@
         </p>
         <ul v-if="list.properties && (list.properties.length > 1 || (list.properties.length == 1 && list.properties[0].value))">
           <li v-for="prop in properties">
-            <span :title="switchParams(prop.property.labelCn, 0)">{{prop.property.labelCn || '-'}}</span>
-            <span :title="switchParams(prop.value, 0)">{{prop.value || '-'}}</span>
+            <span>{{prop.property.labelCn || '-'}}</span>
+            <span :title="prop.value&&prop.value.length > 25 ? switchParams(prop.value, 0): ''">{{prop.value || '-'}}</span>
           </li>
           <li v-if="!isEven(properties.length)">
             <span>-</span>
@@ -197,12 +197,23 @@
         let tmp = ''
         if (str.length > index + 25) {
           tmp += str.substring(index, index + 25)
-          tmp += '&#10;' + this.switchParams(str, index + 25)
+          tmp += '\n' + this.switchParams(str, index + 25)
         } else {
-          tmp += str
+          tmp += str.substring(index, str.length - 1)
         }
         return tmp
       }
+//      getRealLen: function (str) {
+//        let len = 0
+//        for (let i = 0; i < str.length; i++) {
+//          if (str.charCodeAt(i) > 127 || str.charCodeAt(i) === 94) {
+//            len += 2
+//          } else {
+//            len++
+//          }
+//        }
+//        return len
+//      }
     }
   }
 </script>