vue-Split實(shí)現(xiàn)面板分割
更新時間:2022年03月22日 17:12:02 作者:搬磚界的小菇娘
這篇文章主要為大家詳細(xì)介紹了vue-Split實(shí)現(xiàn)面板分割,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
本文實(shí)例為大家分享了vue-Split實(shí)現(xiàn)面板分割的具體代碼,供大家參考,具體內(nèi)容如下

<template>
? <div class="split-pane-wrapper">
? ? <div class="pane pane-left" :style="{width:leftOffsetPercent}">
? ? ? <button @click="handleClick">點(diǎn)擊減少左側(cè)寬度</button>
? ? </div>
? ? <div class="pane-trigger-con" :style="{left:triggerLeft,width:triggerWidthPx}"></div>
? ? <div class="pane pane-right" :style="{left:leftOffsetPercent}"></div>
? </div>
</template>
<script>
export default {
? components: {},
? data() {
? ? return{
? ? ? // 在這定義一個值。這樣用戶可以直接指定占比的值
? ? ? // 在頁面css 布局使用的值 使用計算屬性拼接即可
? ? ? leftOffset:0.3,
? ? ? triggerWidth:8
? ? }
? },
? computed:{
? ? // 動態(tài)屬性去拼接生成css 實(shí)際需要的代%形式的數(shù)據(jù)
? ? leftOffsetPercent(){
? ? ? return `${this.leftOffset * 100}%`
? ? },
? ? triggerWidthPx(){
? ? ? return `${this.triggerWidth}px`
? ? },
? ? triggerLeft(){
? ? ? return `calc(${this.leftOffset * 100}% - ${this.triggerWidth/2}px)`
? ? },
? },
? methods: {
? ? handleClick(){
? ? ? this.leftOffset -= 0.02
? ? }
? },
}
</script>?
<style lang="scss" scoped>
? .split-pane-wrapper{
? ? width: 100%;
? ? height: 100%;
? ? position: relative;
? ? .pane{
? ? ? position: absolute;
? ? ? height: 100%;
? ? ? top:0;
? ? ? &-left{
? ? ? ? /*width: 30%;*/
? ? ? ? background: brown;
? ? ? }
? ? ? &-right{
? ? ? ? right: 0;
? ? ? ? bottom: 0;
? ? ? ? /*left: 30%;*/
? ? ? ? background: chartreuse;
? ? ? }
? ? ? &-trigger-con{
? ? ? ? z-index: 100;
? ? ? ? height: 100%;
? ? ? ? background: red;
? ? ? ? position: absolute;
? ? ? ? top: 0;
? ? ? }
? ? }
? }
</style>
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
關(guān)于pinia的使用和持久化方式(pinia-plugin-persistedstate)
本文介紹了Pinia的使用方法,包括安裝和配置插件pinia-plugin-persistedstate,以及在項目中創(chuàng)建和使用Store模塊,同時,還講解了Pinia的state、getters和actions的使用,并提供了在uniapp中使用持久化插件的總結(jié)2025-02-02
vue項目環(huán)境搭建?啟動?移植操作示例及目錄結(jié)構(gòu)分析
這篇文章主要介紹了vue項目環(huán)境搭建、啟動、項目移植、項目目錄結(jié)構(gòu)分析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步早日升職加薪2022-04-04
vue父組件傳值子組件報錯Avoid?mutating?a?prop?directly解決
這篇文章主要為大家介紹了vue父組件傳值子組件報錯Avoid?mutating?a?prop?directly解決,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-09-09
淺談VUE防抖與節(jié)流的最佳解決方案(函數(shù)式組件)
這篇文章主要介紹了淺談VUE防抖與節(jié)流的最佳解決方案,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-05-05

