uniapp 页面标签 传值 ————— uniapp 定义 接口

父页面

复制代码
<template>
	<view style="margin: 0;height: 100vh;overflow: hidden;">
	
			<scroll-view scroll-y="true" @scrolltolower="scrollToLower"
				:style="'height:calc(100vh - '+(fixedHeigth+navBarHeight+20)+'px);'">
			
				<view class="menu">
				<view 
				  class="item" 
				  v-for="(item, index) in sampleList" 
				  :key="index"
				@click="toPage('/subPackages/association/pages/association/followshotadd?image='+item.sampleImage+'&id='+item.id)"
				>
				    
				  
			</scroll-view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
	
		methods: {
		
		toPage(item) { 
		  uni.navigateTo({ url: item });  
		}


		}
	}
</script>

子页面

复制代码
<template>
	<view style="margin: 0;height: 100vh;overflow: hidden;">
		{{this.receivedImage}}{{this.receivedId}}
	</view>
</template>

<script>
	export default {
		data() {
			return {
				receivedId:[],
				receivedImage: [],
			}
		},
	
// 初始化  接受页面穿过来的数据
		onLoad(options) {
			// 获取上一个页面带来的数据 
			if (options.image) {
				this.receivedImage = options.image.split(',')
				// console.log('接收到的图片参数:', this.receivedImage)
			}

			if (options.id) {
				this.receivedId = options.id;
				console.log(this.receivedId, 'receivedId')
			}
			
		},
		computed: {},
		
	}
</script>

uniapp 定义 接口

复制代码
<!-- uniapp  get  post接口 -->
<!-- 真实接口的数据链接  传值 传id 和 全部数据-->
let makeupDelete = (params = {}) => vm.$u.post(Vue.prototype.currshop.value+'/makeupArtist/delete?id='+params.id, params, normalHeader);
 
<!-- 真实接口的数据链接  传值 传id-->
let makeupDelete = (params = {}) => vm.$u.post(Vue.prototype.currshop.value+'/makeupArtist/delete?id='+params.id);
 
<!-- 真是接口的数据链接  传值 传全部-->
let getSampleSeriesList = (params = {}) => vm.$u.get(Vue.prototype.currshop.value+'/sample/getSampleSeriesList', params, 
normalHeader);
 
<!-- 模拟接口的数据链接 -->
let getSampleSeriesList = (params = {}) => vm.$u.get('http://localhost:8080/travelPhotography-shop/sample/getSampleSeriesList', params, normalHeader);
相关推荐
落魄江湖行几秒前
入门篇八 Nuxt4页面元信息与 SEO:让搜索引擎爱上你的网站
前端·typescript·seo·nuxt4
╰つ栺尖篴夢ゞ2 分钟前
Web之深入解析Cookie的安全防御与跨域实践
前端·安全·存储·cookie·跨域
木斯佳6 分钟前
前端八股文面经大全:腾讯前端一面(2026-04-04)·深度解析
前端·ai·鉴权·monorepo
code_Bo8 分钟前
kiro生成小程序商业案例
前端·微信小程序·小程序·云开发
yellowbuff9 分钟前
为什么你的 0.01 秒倒计时看起来一卡一卡的?
前端
onebyte8bits12 分钟前
NestJS 系列教程(十八):文件上传与对象存储架构(Multer + S3/OSS + 访问控制)
前端·架构·node.js·状态模式·nestjs
Ruihong14 分钟前
放弃 Vue3 传统 <script>!我的 VuReact 编译器做了一次清醒取舍
前端·vue.js
weixin_4561648316 分钟前
vue3 父组件向子组件传参
前端
Beginner x_u18 分钟前
前端八股整理|CSS|高频小题 01
前端·css·八股
蜡台22 分钟前
IDEA LiveTemplates Vue ElementUI
前端·vue.js·elementui·idea·livetemplates