依赖更新

master
toesbieya 6 years ago
parent 0587f322e4
commit c2b526285b
  1. 6
      vue/full/package-lock.json
  2. 5
      vue/full/package.json
  3. 4
      vue/full/src/asset/style/cover/el-admin-layout.scss
  4. 1
      vue/full/src/asset/style/index.scss
  5. 99
      vue/full/src/util/index.js
  6. 18
      vue/full/src/view/_common/ListPage/autoAdaptHeightMixin.js

@ -4535,9 +4535,9 @@
"dev": true
},
"el-admin-layout": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/el-admin-layout/-/el-admin-layout-0.4.0.tgz",
"integrity": "sha512-V4tuNYZVMoBRZjeoRsoMYOqE1iZiaXbSYfWDHYwuQZQ4GVZBvqma9lxujOdeV8E/+JkORAUrffxsOfZxYio7Dw=="
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/el-admin-layout/-/el-admin-layout-0.5.1.tgz",
"integrity": "sha512-nFtk2zrpJ6xsxJM3tAD7+qjHYvBA2MHcayEO6nU3kRpmeC/K0Zxw4WNEUlxbhqCTzziTIX6xl/0Hr325EorvKA=="
},
"electron-to-chromium": {
"version": "1.3.633",

@ -10,7 +10,7 @@
"dependencies": {
"axios": "^0.21.1",
"decimal.js": "^10.2.1",
"el-admin-layout": "^0.4.0",
"el-admin-layout": "^0.5.1",
"element-ui": "^2.14.1",
"file-saver": "^2.0.5",
"js-md5": "^0.7.3",
@ -40,7 +40,6 @@
}
},
"browserslist": [
"> 1%",
"last 2 versions"
"Chrome > 80"
]
}

@ -0,0 +1,4 @@
//如果使用auto的话滚动条会占据容器宽度这样<list-page/>的自适应高度比较麻烦所以偷个懒
.page-main > .scroll-container {
overflow: overlay;
}

@ -6,6 +6,7 @@
//layout中的样式需要覆盖element-ui原定义所以放element-ui的后面
@import "~@/layout/style.scss";
@import "./cover/element-ui.scss";
@import "./cover/el-admin-layout.scss";
@import "./nprogress.scss";
html {

@ -1,6 +1,101 @@
import {isEmpty, getInitialValue, debounce, bindThis, deepClone} from "el-admin-layout/src/util"
/**
* 判断是否为空值undefinednull'' 都视为空值
*
* @param str 不定参数
* @return {boolean} 若为空值返回true否则返回false
*/
export function isEmpty(...str) {
return str.some(i => i === undefined || i === null || i === '')
}
/**
* 根据传入值的类型返回基础起始值
*
* @param v
* @return {boolean|{}|string|*[]|number|null}
*/
export function getInitialValue(v) {
if (v === undefined || v === null) return null
if (typeof v === 'string') return ''
if (typeof v === 'boolean') return false
if (typeof v === 'number') return 0
if (typeof v === 'object') return {}
if (Array.isArray(v)) return []
}
export {isEmpty, getInitialValue, debounce, bindThis, deepClone}
/**
* 防抖
*
* @param func {function} 原函数
* @param wait {number} 防抖间隔单位毫秒
* @param immediate {boolean} 是否立即执行一次
* @return {function} 经过防抖包装后的函数
*/
export function debounce(func, wait = 100, immediate = false) {
let timeout, args, context, timestamp, result
const later = function () {
// 据上一次触发时间间隔
const last = new Date().getTime() - timestamp
// 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait
if (last < wait && last > 0) {
timeout = window.setTimeout(later, wait - last)
}
else {
timeout = null
// 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用
if (!immediate) {
result = func.apply(context, args)
if (!timeout) context = args = null
}
}
}
return function () {
context = this
args = arguments
timestamp = new Date().getTime()
const callNow = immediate && !timeout
// 如果延时不存在,重新设定延时
if (!timeout) timeout = window.setTimeout(later, wait)
if (callNow) {
result = func.apply(context, args)
context = args = null
}
return result
}
}
//将传入对象的所有函数的this绑定为其自身
export function bindThis(obj, root = obj) {
if (!obj || typeof obj !== 'object') return
Object.entries(obj).forEach(([k, v]) => {
if (typeof v === 'function') {
obj[k] = v.bind(root)
}
bindThis(v, root)
})
return obj
}
export function deepClone(source) {
if (source === null || typeof source !== 'object' || source instanceof Promise) {
return source
}
if (Array.isArray(source)) {
return source.map(i => deepClone(i))
}
return Object.keys(source).reduce((obj, key) => {
obj[key] = deepClone(source[key])
return obj
}, {})
}
/**
* 当传入空值时返回默认值

@ -3,7 +3,6 @@
* 监听el-table动态设置max-height属性
*/
import {debounce} from "@/util"
import {findComponentByTag} from "@/util/vue"
export default {
@ -13,7 +12,6 @@ export default {
tableMaxHeight: undefined,
//上一次的maxHeight,解决resize时表格高度不正确
lastTableMaxHeight: undefined,
//表格距离卡片容器底部的理想距离
expectedDistance: undefined
}
@ -41,9 +39,12 @@ export default {
this.calcExpectedDistance()
}
const overHeight = containerDistance + this.expectedDistance - tableDistance
//期望的表格距离视窗底部的距离
const expectedTableDistance = containerDistance + this.expectedDistance
//超出期望的距离,必定是非负数
const overHeight = expectedTableDistance - tableDistance
//overHeight为0说明表格刚好在卡片容器内
//overHeight为0说明表格在卡片容器内
if (overHeight === 0) {
this.tableMaxHeight = this.lastTableMaxHeight
}
@ -55,9 +56,6 @@ export default {
},
mounted() {
//resize必须异步,否则新版chrome(87.0.4280.88)会出问题
this.resize = debounce(this.resize, 0)
this.resizeObserver = new ResizeObserver(this.resize)
this.resizeObserver.observe(this.$el)
const searchFormInstance = findComponentByTag(this, 'search-form')
@ -65,8 +63,12 @@ export default {
this.resizeObserver.observe(searchFormInstance.$el)
}
//卸载resizeObserver
this.$once('hook:beforeDestroy', () => {
this.resizeObserver && this.resizeObserver.disconnect()
if (this.resizeObserver) {
this.resizeObserver.disconnect()
this.resizeObserver = null
}
})
}
}

Loading…
Cancel
Save