VUE基础知识 v-for循环遍历数组

1.先在本地模拟一个数组(项目中后端会给)

data(){
	return{
		orders:[
			{
				text:"苹果",
				price:"35.5",
				num:"5",
			},
			{
				text:"橘子",
				price:"25.5",
				num:"6",
			},
			{
				text:"葡萄",
				price:"35",
				num:"3",
			}
		]
	}
}

2、在需要遍历的标签中进行遍历

  • {{item.text}}

    {{item.price}}元

    {{item.num}}

你可能感兴趣的:(vue基础知识)