navigateTo pass parameter splicing string and object method

navigateTo two ways to pass parameters

1. Splicing routing

When there are few parameters, we generally use splicing routing to jump pages and pass parameters
Please add a picture description

proxy.$tab.navigateTo('/pages/sy/stock/checkstock?stockId=' + item.stockId + '+&yardName=' + item.yardName + '')

when receiving
Please add a picture description

onLoad((option) => {
		cargoSelect()
		const item = reactive(option.stockId)
		console.log('option.stockId', option.stockId);
	})

2. Pass an object

However, when there is too much data, we can't splicing and splicing together, which will make our code very bloated,
so we need to pass an object in the past
Please add a picture description

proxy.$tab.navigateTo('/pages/sy/stock/checkstock?row=' + JSON.stringify(item))

when receiving
Please add a picture description

onLoad((option) => {
		const item = reactive(JSON.parse(option.row))
		console.log('item', item);
	})

Guess you like

Origin blog.csdn.net/H_jrqn/article/details/128840289