医生站-患者列表
This commit is contained in:
20
openhis-ui-vue3/src/directive/common/horizontalScroll.js
Normal file
20
openhis-ui-vue3/src/directive/common/horizontalScroll.js
Normal file
@@ -0,0 +1,20 @@
|
||||
// 表格上滑滚轮滚动条横向滚动,在只有横向滚动条时使用
|
||||
export default {
|
||||
mounted: (el) => {
|
||||
const container = el.querySelector('.el-scrollbar__wrap')
|
||||
if (!container) return
|
||||
|
||||
const handleWheel = (e) => {
|
||||
// 组织默认事件
|
||||
e.preventDefault()
|
||||
const delta = e.deltaY || e.detail || (-e.wheelDelta)
|
||||
container.scrollLeft += delta * 0.6
|
||||
}
|
||||
|
||||
container.addEventListener('wheel', handleWheel, { passive: false })
|
||||
el._horizontalScrollCleanup = () => container.removeEventListener('wheel', handleWheel)
|
||||
},
|
||||
unmounted: (el) => {
|
||||
el._horizontalScrollCleanup?.()
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
import hasRole from './permission/hasRole'
|
||||
import hasPermi from './permission/hasPermi'
|
||||
import copyText from './common/copyText'
|
||||
import horizontalScroll from './common/horizontalScroll'
|
||||
|
||||
export default function directive(app){
|
||||
app.directive('hasRole', hasRole)
|
||||
app.directive('hasPermi', hasPermi)
|
||||
app.directive('copyText', copyText)
|
||||
app.directive('horizontal-scroll', horizontalScroll)
|
||||
}
|
||||
Reference in New Issue
Block a user