vuepress-plugin-blog
vuepress-plugin-blog copied to clipboard
[Feature Request] Add $ref attribute to Vssue component to allow accessing component data from parent
Feature request
Add a $ref
attribute to the <Vssue/>
component inside of the default <Comment/>
component.
What problem does this feature solve?
Currently, the number of comments on a post (and other <Vssue/>
component data) are not easily available through the Vue instance.
Adding a $ref
attribute to the <Vssue/>
component would allow a parent component to access the $data
object for accessing the comment count and other data for display in other components on the page.
How should this be implemented in your opinion?
Inside the <Comment/>
component, add a ref
attribute to both comment service components:
<template>
<Vssue v-if="$service.comment.service === 'vssue'" v-bind="vssueProps" ref="vssueComments"/>
<Disqus
v-else-if="$service.comment.service === 'disqus'"
v-bind="disqusProps"
ref="disqusComments"
/>
</template>
Are you willing to work on this yourself?
Yes; however, you may want to implement via props or something if you'd like the user to be able to customize the ref
attribute by passing the string as a prop on the <Comment/>
component.