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);
相关推荐
哆啦A梦15886 小时前
商城后台管理系统 03 登录布局
javascript·vue.js·elementui
曼巴UE56 小时前
UE FString, FName ,FText 三者转换,再次学习,官方文档理解
服务器·前端·javascript
selt7917 小时前
Redisson之RedissonLock源码完全解析
android·java·javascript
行走的陀螺仪7 小时前
高级前端 Input 公共组件设计方案(Vue3 + TypeScript)
前端·javascript·typescript·vue·组件设计方案
一颗不甘坠落的流星7 小时前
【Antd】基于 Upload 组件,导入Json文件并转换为Json数据
前端·javascript·json
LYFlied8 小时前
Vue2 与 Vue3 虚拟DOM更新原理深度解析
前端·javascript·vue.js·虚拟dom
Lucky_Turtle8 小时前
【Node】npm install报错npm error Cannot read properties of null (reading ‘matches‘)
前端·npm·node.js
小飞侠在吗8 小时前
vue shallowRef 与 shallowReacitive
前端·javascript·vue.js
惜分飞9 小时前
sql server 事务日志备份异常恢复案例---惜分飞
前端·数据库·php