Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I write directive ,I want to use a attribute in update,this attribute is create bind #9690

Closed
shiqian123 opened this Issue Mar 13, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@shiqian123
Copy link

shiqian123 commented Mar 13, 2019

Version

2.5.20

Reproduction link

https://jsfiddle.net/9ag4xtvu/12/

Steps to reproduce

I want to get an initialized value for comparison。
Vue.directive('diff', {
inserted: function (el,bind,vnode) {
bind.initData = bind.value
console.log(vnode)
},
update:function(el,bind,vnode){
console.log(bind.initData)
}
})

What is expected?

in update, bind.initdata will have value

What is actually happening?

bind.initdata is undefined

@posva

This comment has been minimized.

Copy link
Member

posva commented Mar 13, 2019

if you want to add data, add it to the element itself


Remember you can use the forum or the Discord chat to ask quick questions!

@posva posva closed this Mar 13, 2019

@shiqian123

This comment has been minimized.

Copy link
Author

shiqian123 commented Mar 13, 2019

I want to get an initialized value for subsequent comparisons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.