我是靠谱客的博主 优秀缘分,这篇文章主要介绍vue props 一次传多个值实例,现在分享给大家,希望可以做个参考。

数组:

<custom-element :whatever="[...array]"></custom-element>

对象:

<custom-element :whatever="{...obj}"></custom-element>

或者:

<custom-element v-bind="obj" </custom-element>

子组件:

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<ul class="car_wrap"> <li > <span> <i class="fa fa-clock-o clock_icon" aria-hidden="true"></i> </span> <p>{{propsText.seleTime}}</p> </li> <li class="car_start"> <span> <i class="fa fa-circle circle_icon" aria-hidden="true"></i> </span> <p>{{propsText.carsStart}}</p> </li> <li class="car_end"> <span> <i class="fa fa-circle circle_icon" aria-hidden="true"></i> </span> <p>{{propsText.carEnd}}</p> </li> <li class="remark"> <span> <i class="fa fa-circle circle_icon" aria-hidden="true"></i> </span> <p>{{propsText.Remark}}</p> </li> </ul> <div class="confirmation_car"> props: { propsText:{ type: Object, default:{} } },

父组件:

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!-- 选择内容 --> <div class="select_content"> <app-footer-car :clock="clock" :propsText="{...propsText}"/> </div> import appFooterCar from "../FooterCarList/FooterCarList"; data() { return { propsText:{ seleTime:11, carsStart:22, carEnd:33, Remark:44, confirmationCar:55 } };

补充知识:vue props 属性值接受多个类型

我就废话不多说了,大家还是直接看代码吧~

复制代码
1
2
3
4
5
6
7
8
originalData: { type: Array | Object, default () { return [] } } } ```

以上这篇vue props 一次传多个值实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持靠谱客。

最后

以上就是优秀缘分最近收集整理的关于vue props 一次传多个值实例的全部内容,更多相关vue内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(200)

评论列表共有 0 条评论

立即
投稿
返回
顶部