update
This commit is contained in:
1 parent
a21491f7cf
commit
c6bdfe6bc5
3 files changed
+46
No files matched your search
@@ -0,0 +1,27 @@
|
||||
# 与vue项目相关
|
||||
|
||||
---
|
||||
## 具名作用域插槽
|
||||
* 具名作用域插槽的工作方式也是类似的,插槽 props 可以作为 v-slot 指令的值被访问到
|
||||
|
||||
```
|
||||
<MyComponent>
|
||||
<template #header="headerProps">
|
||||
{{ headerProps }}
|
||||
</template>
|
||||
|
||||
<template #default="defaultProps">
|
||||
{{ defaultProps }}
|
||||
</template>
|
||||
|
||||
<template #footer="footerProps">
|
||||
{{ footerProps }}
|
||||
</template>
|
||||
</MyComponent>
|
||||
```
|
||||
* 传入props
|
||||
```
|
||||
<slot name="header" message="hello"></slot>
|
||||
```
|
||||
* 是由插件传回父组件,如上面的message会被headerProps收到,可以根据此进行进一步的处理。
|
||||
---
|
||||
Reference in new issue
Block a user