微信小程序将page值传到Compoents页面中,亲测可用!!!

不废话,直接上逻辑代码。

父页面

index.json

{
    
    
  "usingComponents": {
    
    
    "house-item": "/components/....",//子页面路径
  }
}

index.wxml

直接在标签中定义属性即可。

<house-item  imgurl='{
    
    {
    
    imgurl}}'></house-item>

子页面

house-item.js

在properties中定义属性

properties: {
    
        
    imgurl:String,
  },

然后在wxml中直接使用{ {imgurl}}即可获取

猜你喜欢

转载自blog.csdn.net/qq_16607641/article/details/128852295