implement notes
This commit is contained in:
@ -2,7 +2,21 @@
|
||||
// update. https://github.com/phoenixframework/phoenix_live_view/issues/1011
|
||||
|
||||
export default {
|
||||
attrs () { return this.el.getAttribute('data-attrs').split(', ') },
|
||||
beforeUpdate () { this.prevAttrs = this.attrs().map(name => [name, this.el.getAttribute(name)]) },
|
||||
updated () { this.prevAttrs.forEach(([name, val]) => this.el.setAttribute(name, val)) }
|
||||
attrs () {
|
||||
if (this.el && this.el.getAttribute('data-attrs')) {
|
||||
return this.el.getAttribute('data-attrs').split(', ')
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
},
|
||||
beforeUpdate () {
|
||||
if (this.el) {
|
||||
this.prevAttrs = this.attrs().map(name => [name, this.el.getAttribute(name)])
|
||||
}
|
||||
},
|
||||
updated () {
|
||||
if (this.el) {
|
||||
this.prevAttrs.forEach(([name, val]) => this.el.setAttribute(name, val))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user