Vue3 中可以使用自定义指令来封装一个滚动条。
首先,在需要使用滚动条的组件中定义自定义指令:
import { directive } from 'vue'
export const scroll = directive((el, binding) => {
// 滚动条实现代码
})
Vue3 中可以使用自定义指令来封装一个滚动条。
首先,在需要使用滚动条的组件中定义自定义指令:
import { directive } from 'vue'
export const scroll = directive((el, binding) => {
// 滚动条实现代码
})