Authored by QC-L

添加原生小程序与 taro 混编的示例 review by 黄敬囿

... ... @@ -30,7 +30,8 @@ class App extends Component {
'pages/message/index',
'pages/userCenter/index',
'pages/login/index',
'pages/orderList/index'
'pages/orderList/index',
'pages/nativeTest/nativeTest'
],
window: {
backgroundTextStyle: 'light',
... ...
... ... @@ -110,6 +110,12 @@ export default class Index extends Component {
}
}
gotoNative() {
Taro.navigateTo({
url: '/pages/nativeTest/nativeTest'
})
}
render() {
let {tabs, productList} = this.state;
let {filterMenu} = this.props;
... ... @@ -126,6 +132,7 @@ export default class Index extends Component {
<View className="header-nav">
<Text className="page-label">飞碟好物</Text>
<Text onClick={this.gotoNative}>跳转原生页面</Text>
<Navigator url="/pages/search/index" className="search" hover-class="none"><Image className="search-btn" src={searchImg}></Image></Navigator>
</View>
... ...
Page({
/**
* 页面的初始数据
*/
data: {
text: '哈哈哈哈'
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{
}
\ No newline at end of file
... ...
<text>我是原生的 {{text}}</text>
\ No newline at end of file
... ...