1234567891011121314151617181920 |
- type typeKey = {
- [key: string]: any;
- }
- const allDirectives: typeKey = {
- title: {
- inserted (el: any) {
- const { clientWidth, scrollWidth, title } = el
- if (!title && scrollWidth > clientWidth) el.title = el.innerText
- }
- }
- }
- export default (Vue: any) => {
- Object.keys(allDirectives).forEach((n: any) => Vue.directive(n, allDirectives[n]))
- }
|