解决Error: Not Found:Page[5][-1,81] at view.umd.min.js

场景说明:

  1. uniapp使用组件,在APP环境出现,在H5环境正常。
  2. 单页面上多处使用该组件,使用同名参数设置数据,应用切换效果时,触发请求不同接口,返回数据格式不同。
  3. 使用v-if时出现,使用v-show时正常。

原因分析:
尚不明确。

解决方案1:
将组件注册多个不同名称来使用,对应不同的返回数据。

<template>
	<vTabs v-model="active" @change="handelTabs"></vTabs>
	<view v-if="active == 0">
		<vTabs1 :tabs="type1"></vTabs1>
	</view>
	<view v-if="active == 1">
		<vTabs2 :tabs="type1"></vTabs2>
	</view>
</template>
<script>
	import vTabs from "@/components/v-tabs.vue"
	import vTabs1 from "@/components/v-tabs.vue"
	import vTabs2 from "@/components/v-tabs.vue"
	export default {
		computed: mapState([]),
		components: {
			vTabs,
			vTabs1,
			vTabs2
		},
		data() {
			return {
				active: 0,
				type: [],
			}
		},
		methods: {
			handelTabs(index) {
				this.active = index
				if (this.active == 0) {
					this.type = ["a","b","c"]
				}
				if (this.active == 1) {
					this.type = [[{"id":1,"name":"a"},{"id":2,"name":"b"},{"id":3,"name":"c"}]
				}
			}
		}
	}
</script>

解决方案2:
切换判断条件全部使用v-show。

<template>
	<vTabs v-model="active" @change="handelTabs"></vTabs>
	<view v-show="active == 0">
		<vTabs1 :tabs="type1"></vTabs1>
	</view>
	<view v-show="active == 1">
		<vTabs1 :tabs="type1"></vTabs1>
	</view>
</template>
<script>
	import vTabs from "@/components/v-tabs.vue"
	import vTabs1 from "@/components/v-tabs.vue"
	export default {
		computed: mapState([]),
		components: {
			vTabs,
			vTabs1
		},
		data() {
			return {
				active: 0,
				type: [],
			}
		},
		methods: {
			handelTabs(index) {
				this.active = index
				if (this.active == 0) {
					this.type = ["a","b","c"]
				}
				if (this.active == 1) {
					this.type = [[{"id":1,"name":"a"},{"id":2,"name":"b"},{"id":3,"name":"c"}]
				}
			}
		}
	}
</script>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值