久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網
      最全最豐富的資訊網站

      Vue基于iview table展示圖片實現(xiàn)點擊放大功能

      Vue基于iview table展示圖片實現(xiàn)點擊放大功能

      首先先安裝依賴:

      npm install v-viewer --save

      然后全局引入,我這邊是在main.js里面操作寫的:

      import Viewer from 'v-viewer'
      import 'viewerjs/dist/viewer.css'

      相關學習推薦:javascript教程

      然后注冊下:

      Vue.use(Viewer) Viewer.setDefaults({   Options: { 'inline': true, 'button': true, 'navbar': true, 'title': true, 'toolbar': true, 'tooltip': true, 'movable': true, 'zoomable': true, 'rotatable': true, 'scalable': true, 'transition': true, 'fullscreen': true, 'keyboard': true, 'url': 'data-source' } })

      使用的一個demo就是:

      <viewer :images="tupians">    <i-col span="4" v-for="item in tupians">      <p class="detailed">       <img :src="item.img" alt="">      </p>    </i-col> </viewer>

      其中item.img其實就是一個路徑。

      在回到iview表格中,

      需要以

            h('xxxx', {         props: {           trigger: 'hover',           placement: 'top',           content: '二維碼'         }       }, [       ])

      這種格式渲染出來,第一個參數是標簽,第二參數是標簽里面可以含props(vue的v-bind),也可以包含屬性。第三個參數是數組,表示子標簽。子標簽也是這種格式的,以此遞歸下去。

      所以改寫成這種格式的,在本人項目中的一個demo如下,就可以實現(xiàn)在表格中點擊圖片進行放大展示:

      {   title: '二維碼',   align: 'center',   render: (h, params) => {     console.log('h, param', params);     let devicesArr = [];     let photo = [];     photo.push('/erweima/'+params.row.pt_number+'.png');     devicesArr.push(       h('Tooltip', {         props: {           trigger: 'hover',           placement: 'top',           content: '二維碼'         }       }, [         h('viewer', {           props:{             images:photo           }         }, [           h('img', {             attrs: {               src:photo[0],               style: 'width: 22px;margin-right:5px'             },           })         ])       ])     );     return h('p', devicesArr);   } }

      相關學習推薦:編程視頻

      贊(0)
      分享到: 更多 (0)
      網站地圖   滬ICP備18035694號-2    滬公網安備31011702889846號