custom-component.js
Component({ properties: { id: { type: String, }, }, });
custom-component.wxml
<view >{{id}}</view>
Page中使用
<custom-component id="8057"></custom-component>
发现Component并没有接收到参数id, 需要换一个参数名,比如detail-id, 就可以正常接收到父组件传递过来的参数
修改如下
custom-component.js
Component({ properties: { detailId: { type: String, }, }, });
custom-component.wxml
<view >{{detailId}}</view>
Page中使用
<custom-component detail-id="8057"></custom-component>