Skip to content

Commit 6fad1d6

Browse files
committed
fix(vAttributes): fix missing directive
1 parent 919f116 commit 6fad1d6

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/directives/vAttributes.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
function setAttributes (el, binding) {
2+
let attributes = {}
3+
4+
if (binding.instance.schema?.attributes) {
5+
attributes = { ...binding.instance.schema?.attributes }
6+
}
7+
8+
const container = binding.value || 'input'
9+
if ( typeof container === 'string' ) {
10+
attributes = attributes[container] || attributes
11+
}
12+
13+
Object.entries(attributes).forEach(([ key, value ]) => {
14+
el.setAttribute(key, value)
15+
})
16+
}
17+
18+
export const vAttributes = {
19+
beforeMount: (el, binding) => setAttributes(el, binding),
20+
updated: (el, binding) => setAttributes(el, binding)
21+
}

0 commit comments

Comments
 (0)