微信小程序组件传参
微信小程序组件传参
1.父组件。
.json文件
"usingComponents": {
"nav-bar": "/components/navBar/navBar"
},
"navigationStyle": "custom" // 如果是头部自定义 需要此设置
.wxml文件
<nav-bar title="我的"></nav-bar> // 传参title 引号中如果是data 数据 需要用 {{}}括起来
2.子组件
.json文件
"component": true,
.js文件
Component({
/**
* 组件的属性列表
*/
properties: {
title: {
type: String
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})

浙公网安备 33010602011771号