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);
相关推荐
Aliex_git几秒前
性能优化 - Vue 日常实践优化
前端·javascript·vue.js·笔记·学习·性能优化
董世昌413 分钟前
添加、删除、替换、插入元素的全方法指南
java·开发语言·前端
qq_316837759 分钟前
Element-Plus el-table lazy 自动更新子列表
前端·vue.js·elementui
xiaoxue..11 分钟前
把大模型装进自己电脑:Ollama 本地部署大模型完全指南
javascript·面试·node.js·大模型·ollama
林恒smileZAZ29 分钟前
Electron 的西天取经
前端·javascript·electron
这就是佬们吗34 分钟前
告别 Node.js 版本冲突:NVM 安装与使用全攻略
java·linux·前端·windows·node.js·mac·web
IT_陈寒38 分钟前
2024年JavaScript开发者必备的10个ES13新特性实战指南
前端·人工智能·后端
Miketutu38 分钟前
Flutter - 布局
开发语言·javascript·ecmascript
满栀58540 分钟前
基于 jQuery 实现商品列表增删改查与数据统计
前端·javascript·jquery
web小白成长日记40 分钟前
CSS 作用域隔离实战:React、Vue 与 Styled Components 的三种范式
前端·css·vue.js·react.js