当前位置:网站首页>01. A simpler way to deliver a large number of props
01. A simpler way to deliver a large number of props
2022-07-25 16:11:00 【@Move to the world】
today , Let's learn about Vue Skills booklet , This is the first lesson , That is, the title shows : Deliver a lot of... In a simpler way props, The example is vue3 To demonstrate , Of course. vue2 Also applicable in .
Let's get straight to the point , Suppose we have a component that displays user information , As shown below :
<template>
<div>
<p> full name :{
{ name }}</p>
<p> occupation :{
{ job }}</p>
<p> Age :{
{ age }}</p>
</div>
</template>
<script setup>
import { ref } from 'vue'
defineProps({
name: String,
job: String,
age: Number,
})
const count = ref(0)
</script>
This component receives three parameters , Namely User name 、 Work 、 And age . stay template The corresponding three field values are displayed in .
then , In parent component , introduce User Components , Make a statement userInfo object , And then to User The component passes in these three parameters , As shown below :
<template>
<User :name="userInfo.name" :job="userInfo.job" :age="userInfo.age" />
</template>
<script setup>
import { reactive } from 'vu边栏推荐
猜你喜欢

使用Huggingface在矩池云快速加载预训练模型和数据集

ML - Speech - traditional speech model

Circulaindicator component, which makes the indicator style more diversified

Wavelet transform --dwt2 and wavedec2

How matlab saves all the data after running

狂神redis笔记12

一文入门Redis

可验证随机函数 VRF

"Digital security" alert NFT's seven Scams

电阻电路的等效变化(Ⅱ)
随机推荐
MySQL implicit lock
JWT diagram
Data system partition design - Request Routing
权限管理-删除菜单(递归)
MySQL self incrementing lock
基于Caffe ResNet-50网络实现图片分类(仅推理)的实验复现
MySQL tutorial 65 data in MySQL operation table
Ice 100g network card fragment message hash problem
MySQL intent lock
通用测试用例写作规范
MySQL乐观锁
狂神redis笔记12
Copy a word style template to another document
leetcode:154. 寻找旋转排序数组中的最小值 II【关于旋转排序数组的中后定位二分法】
MySQL 元数据锁(MDL)
意向锁(Intention Lock)
TypeError: Unrecognized value type: <class ‘str‘> ParserError: Unknown string format
Recommended collection, which is probably the most comprehensive coding method summary of category type features
"Digital security" alert NFT's seven Scams
如何构建面向海量数据、高实时要求的企业级OLAP数据引擎?