-
Notifications
You must be signed in to change notification settings - Fork 114
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
Add memberObj in @at event #50
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, but needs more improvement as I commented 😃
src/At.vue
Outdated
return i; | ||
} | ||
}); | ||
this.$emit('at', memberObj); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would cause a breaking change which we should try to avoid 😃
@@ -17,6 +17,7 @@ | |||
<ul class="atwho-ul"> | |||
<li v-for="(item, index) in atwho.list" | |||
class="atwho-li" | |||
:key="index" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 we do need a :key
in v-for
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/At.vue
Outdated
@@ -255,7 +255,12 @@ export default { | |||
} else { | |||
const { members, filterMatch, itemName } = this | |||
if (!keep && chunk.length>0) { | |||
this.$emit('at', chunk) | |||
const memberObj = Object.values(this.members).filter((i) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried about cross-browser compatibility of Object.values
(not supported in IE, etc)
https://caniuse.com/#search=object.values
@fritx I updated the code with the requested changes! |
src/At.vue
Outdated
} | ||
}); | ||
this.$emit('at', memberObj); | ||
this.$emit('at', memberObj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, but I had thought what if we $emit('at', chunk, memberObj)
the memberObj
as the third arg... lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so that we could let go the new added prop showMemberObj
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gonna update now
Yes, it seems a better way to write it, sorry about that hahaha
On Tue, 27 Mar 2018 at 01:10 Fritz Lin ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/At.vue
<#50 (comment)>:
> }
});
- this.$emit('at', memberObj);
+ this.$emit('at', memberObj)
Great, but I had thought what if we $emit('at', chunk, memberObj)
the memberObj as the third arg... lol
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#50 (review)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AGlOf6hWMpa-HcjScEiz5TF9DuQCsEyRks5tibvHgaJpZM4S5H-6>
.
--
Att, Ricardo Goldstein via iPhone
|
@fritx just add the third argument. |
@at events were always broken, need to be fixed
@goldsteinr thanks for the PR, but I made some further changes:
<at @insert="handleInsert"></at>
methods: {
handleInsert (item) { /* ... */ }
} |
@fritx cool :) can we get a release of it? |
I added the possibility to get the member's array object instead of just the text.
Example: I want a user email and not only his name. With the handler now, we get the member obj to use any information we want.
closes #49