maoruibin / maoruibin/maoruibin.github.com
Vue 父组件调用子组件方法
Open
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 22
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
组件关系
app.vue
<el-main >
<Container
v-show="!dashboard"
:user="user"
@showTodoDetail="showTodoDetail"/>
<Dashboard
v-show="dashboard"/>
</el-main>
showDashboard:function(){
//
}
其中包含子组件 Dashboard
现在需要在 showDashboard 方法中调用到 Dashboard 的方法 refresh
dashboard.vue
methods: {
refresh:function(){
console.log("---------------")
},
只需要在组件声明处 定义好 ref 对象,
<Dashboard
v-show="dashboard"
ref="dashboard"/>
然后
showDashboard:function(){
this.$refs.dashboard.refresh()
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names app.vue and dashboard.vue and shows showDashboard, Dashboard, and refresh as entry points. Start by locating the corresponding content in the blog repository; no target file, test, or acceptance criteria is provided, so the definition of done cannot be determined from the issue alone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html, javascript
- Domain
- documentation, frontend
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100