-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ignore: 服务调用加上返回值 * feat: meVxeTable组件加上高度自动计算 * feat: 加上标准布局页面组件 * fix: meVxeTable高度100%加到组件中
- Loading branch information
1 parent
c1c8689
commit 5340a07
Showing
9 changed files
with
165 additions
and
11,097 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// 监听元素大小变化的指令 | ||
const map = new WeakMap() | ||
const ob = new ResizeObserver((entries) => { | ||
for (const entry of entries) { | ||
// 获取dom元素的回调 | ||
const handler = map.get(entry.target) | ||
//存在回调函数 | ||
if (handler) { | ||
// 将监听的值给回调函数 | ||
handler({ | ||
width: entry.borderBoxSize[0].inlineSize, | ||
height: entry.borderBoxSize[0].blockSize | ||
}) | ||
} | ||
} | ||
}) | ||
|
||
export const Resize = { | ||
mounted(el: any, binding: any) { | ||
//将dom与回调的关系塞入map | ||
map.set(el, binding.value) | ||
//监听el元素的变化 | ||
ob.observe(el) | ||
}, | ||
unmounted(el: any) { | ||
//取消监听 | ||
ob.unobserve(el) | ||
} | ||
} | ||
|
||
export default Resize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* 获取元素的高度包括marign | ||
* @param el | ||
* @returns | ||
*/ | ||
export const getFullHight = (el:HTMLDivElement)=>{ | ||
const offsetHeight = el.offsetHeight; | ||
const marginTop = window.getComputedStyle(el).marginTop.replace('px',''); | ||
const marginBottom = window.getComputedStyle(el).marginBottom.replace('px',''); | ||
return offsetHeight + (+marginTop) + (+marginBottom) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<template> | ||
<div class="page page-100 page-padding"> | ||
<el-card v-if="$slots.searchForm" class="seach-header"> | ||
<slot name="searchForm"></slot> | ||
</el-card> | ||
<el-card class="content-body" body-style="height:100%" > | ||
<slot></slot> | ||
</el-card> | ||
<slot name="extend"></slot> | ||
</div> | ||
</template> | ||
<style lang="scss" scoped> | ||
.page{ | ||
.seach-header{ | ||
flex-shrink: 0; | ||
} | ||
.content-body{ | ||
flex:1; | ||
} | ||
.content-body:nth-child(n+2){ | ||
margin-top: 10px; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters