欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Vue實(shí)現(xiàn)拖拽式分割布局

 更新時間:2022年03月21日 15:48:26   作者:默默的小跟班  
這篇文章主要為大家詳細(xì)介紹了Vue實(shí)現(xiàn)拖拽式分割布局,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了Vue實(shí)現(xiàn)拖拽式分割布局的具體代碼,供大家參考,具體內(nèi)容如下

示例展示

代碼

特地寫了一個demo代碼,可以直接復(fù)制下來運(yùn)行

<!DOCTYPE html>
<html lang="en">
<head>
? ? <meta charset="UTF-8">
? ? <meta name="viewport" content="width=device-width, initial-scale=1.0">
? ? <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
? ? <title>Document</title>
</head>
<body>
<div id="app">
? <div class='container' id='container'>
? ? <div id='top' class='top'>top</div>
? ? <div id='bar' class='bar'></div>
? ? <div id='bottom' class='bottom'>bottom</div>
? </div>
</div>
<script>
var app = new Vue({
? ? el: '#app',
? ? data: {
? ? },
? ? mounted(){
? ? ? this.dragChangeHeight('bar','top')
? ? },
? ? methods:{
? ? ? dragChangeHeight(drag, panel) {
? ? ? ? var dragEl = document.getElementById(drag)
? ? ? ? var panelEl = document.getElementById(panel)
? ? ? ? dragEl.onmousedown = function(ev) {
? ? ? ? ? var disH = panelEl.offsetHeight
? ? ? ? ? var disY = ev.clientY
? ? ? ? ? var disT = panelEl.offsetTop
? ? ? ? ? var b = ''
? ? ? ? ??
? ? ? ? ? document.onmousemove = function(ev) {
? ? ? ? ? ? panelEl.style.height = disH + (ev.clientY - disY) + 'px'
? ? ? ? ? ? // panelEl.style.top = disL - (ev.clientY - disY) + 'px'
? ? ? ? ? }

? ? ? ? ? document.onmouseup = function() {
? ? ? ? ? ? document.onmousemove = document.onmouseup = null
? ? ? ? ? }
? ? ? ? ? return false
? ? ? ? }
? ? ? },
? ? ? dragChangeWidth(drag, panel) {
? ? ? ? var dragEl = document.getElementById(drag)
? ? ? ? var panelEl = document.getElementById(panel)
? ? ? ? dragEl.onmousedown = function(ev) {
? ? ? ? ? var disW = panelEl.offsetWidth
? ? ? ? ? var disX = ev.clientX
? ? ? ? ? var disL = panelEl.offsetLeft
? ? ? ? ? var b = ''

? ? ? ? ? document.onmousemove = function(ev) {
? ? ? ? ? ? ? panelEl.style.width = disW + (ev.clientX - disX) + 'px'
? ? ? ? ? ? ? // panelEl.style.left = disL - (ev.clientX - disX) + 'px'
? ? ? ? ? }

? ? ? ? ? document.onmouseup = function() {
? ? ? ? ? ? document.onmousemove = document.onmouseup = null
? ? ? ? ? }
? ? ? ? ? return false
? ? ? ? }
? ? ? },
? ? }
})
</script>

<style>
? body{
? ? margin: 0;
? }
? .container{
? ? /* padding: 20px; */
? ??
? ? height: 90vh;
? ? width: 90vw;
? ? display: flex;
? ? flex-direction: column;
? }
? .top{
? ? width: 100%;
? ? height: 300px;
? ? background-color: blue;
? }
? .bar{
? ? width: 100%;
? ? height: 10px;
? ? cursor: n-resize;
? ? background-color: black;
? }
? .bottom{
? ? width: 100%;
? ? flex: auto;
? ? background-color: red;
? }
</style>
</body>
</html>

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • vue axios請求頻繁時取消上一次請求的方法

    vue axios請求頻繁時取消上一次請求的方法

    這篇文章主要介紹了vue axios請求頻繁時取消上一次請求的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-11-11
  • vue3 teleport的使用案例詳解

    vue3 teleport的使用案例詳解

    這篇文章主要介紹了vue3 teleport的使用demo,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2021-11-11
  • vue2.0父子組件間通信的實(shí)現(xiàn)方法

    vue2.0父子組件間通信的實(shí)現(xiàn)方法

    本篇文章主要介紹了vue2.0父子組件間通信的實(shí)現(xiàn)方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下。
    2017-04-04
  • Vue簡化用戶查詢/添加功能的實(shí)現(xiàn)

    Vue簡化用戶查詢/添加功能的實(shí)現(xiàn)

    本文主要介紹了Vue簡化用戶查詢/添加功能的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-01-01
  • vscode中vue代碼提示與補(bǔ)全沒反應(yīng)解決(vetur問題)

    vscode中vue代碼提示與補(bǔ)全沒反應(yīng)解決(vetur問題)

    這篇文章主要給大家介紹了關(guān)于vscode中vue代碼提示與補(bǔ)全沒反應(yīng)解決(vetur問題)的相關(guān)資料,文中通過圖文將解決的方法介紹的非常詳細(xì),需要的朋友可以參考下
    2023-03-03
  • vue-router之路由鉤子函數(shù)應(yīng)用小結(jié)

    vue-router之路由鉤子函數(shù)應(yīng)用小結(jié)

    vue-router提供的導(dǎo)航鉤子主要用來攔截導(dǎo)航,讓它完成跳轉(zhuǎn)或取消,本文主要介紹了vue-router之路由鉤子函數(shù)應(yīng)用小結(jié),具有一定的參考價值,感興趣的可以了解一下
    2024-01-01
  • vue如何實(shí)現(xiàn)關(guān)閉對話框后刷新列表

    vue如何實(shí)現(xiàn)關(guān)閉對話框后刷新列表

    這篇文章主要介紹了vue如何實(shí)現(xiàn)關(guān)閉對話框后刷新列表,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-04-04
  • 使用vue實(shí)現(xiàn)通過變量動態(tài)拼接url

    使用vue實(shí)現(xiàn)通過變量動態(tài)拼接url

    這篇文章主要介紹了使用vue實(shí)現(xiàn)通過變量動態(tài)拼接url,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-07-07
  • Vue中watch與watchEffect的區(qū)別詳細(xì)解讀

    Vue中watch與watchEffect的區(qū)別詳細(xì)解讀

    這篇文章主要介紹了Vue中watch與watchEffect的區(qū)別詳細(xì)解讀,watch函數(shù)與watchEffect函數(shù)都是監(jiān)聽器,在寫法和用法上有一定區(qū)別,是同一功能的兩種不同形態(tài),底層都是一樣的,需要的朋友可以參考下
    2023-11-11
  • vue 使用lodash實(shí)現(xiàn)對象數(shù)組深拷貝操作

    vue 使用lodash實(shí)現(xiàn)對象數(shù)組深拷貝操作

    這篇文章主要介紹了vue 使用lodash實(shí)現(xiàn)對象數(shù)組深拷貝操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-09-09

最新評論