提交 8ad98865 编写于 作者: 砖业洋__'s avatar 砖业洋__

step6 将主页面中picker选择的值传递到第二个页面中

上级 b30780ed
import router from '@system.router';
let pickerValue1 = null;
let pickerValue2 = null;
export default {
data: {
picker1range: ["1", "2", "3"],
......@@ -7,14 +10,20 @@ export default {
},
clickAction() {
router.replace({
uri:"pages/xunlian/xunlian"
uri: "pages/xunlian/xunlian",
params: { // 传递到目标页面的参数
"data1": pickerValue1,
"data2": pickerValue2
}
})
},
changeAction1(pv) {
console.log("左边的选中项:" + pv.newValue);
pickerValue1 = pv.newValue;
},
changeAction2(pv) {
console.log(`右边的选中项:${pv.newValue}`); // 说明ES6也是支持的
pickerValue2 = pv.newValue;
},
onInit() {
console.log("主页面的onInit()被调用");
......
......@@ -10,6 +10,8 @@ export default {
},
onInit() {
console.log("xunlian页面的onInit()被调用");
console.log(`接收到左边picker的值为:${this.data1}`);
console.log(`接收到右边picker的值为:${this.data2}`);
},
onReady() {
console.log("xunlian页面的onReady()被调用");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册