在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答/HTML5  HTML/ vue 如何實(shí)現(xiàn)切割字符串,并隔行顯示

vue 如何實(shí)現(xiàn)切割字符串,并隔行顯示

若字符串長(zhǎng)度<6,正常渲染,

若字符串超出6個(gè)字,則進(jìn)行分割,存入數(shù)組,

clipboard.png

點(diǎn)擊展示剩余字符串內(nèi)容,圖中是jq實(shí)現(xiàn),vue新手,請(qǐng)教下vue用v-for指令如何實(shí)現(xiàn)?

THML部分代碼:

      <tr class="hap_table_tr">
        <td class="hap_table_bank"><p>工行</p></td>
        <td><p>不準(zhǔn)入</p></td>
        <td><time>2018-05-23</time></td>
        <td class="hap_table_notes"><p class="hap_table_note">備注備注</p><i class="hap_table_drop1"></i></td>
      </tr>
      <tr class="hap_table_tr">
        <td class="hap_table_bank"><p>建行</p></td>
        <td><p>談費(fèi)率</p></td>
        <td><time>2018-05-23</time></td>
        <td class="hap_table_notes"><p class="hap_table_note">備注備注備注安大師傅</p><i class="hap_table_drop1"></i></td>
      </tr>
      <tr class="hap_table_tr">
        <td class="hap_table_bank"><p>農(nóng)行</p></td>
        <td><p>協(xié)議流轉(zhuǎn)</p></td>
        <td><time>2018-05-23</time></td>
        <td class="hap_table_notes"><p class="hap_table_note">即將拉開交流解決骷髏精靈</p><i class="hap_table_drop1"></i></td>
      </tr>
回答
編輯回答
傲嬌范

一個(gè)思路,首先,給hap_table_note類名加個(gè)限高,六字寬度。然后判斷數(shù)據(jù)長(zhǎng)度,大于6,顯示后邊圖標(biāo),否則不顯示。當(dāng)點(diǎn)擊后,去掉限高即可顯示完整

2017年11月8日 00:35
編輯回答
茍活

新建一個(gè)組件傳入字符串,組件內(nèi)部維護(hù)一個(gè)bool變量。默認(rèn)顯示6個(gè)字以下。點(diǎn)擊將這個(gè)變量置為true,組件顯示完整字符串

2018年2月20日 05:15