<navigator url=
"/pages/menu"
hover-
class
=
"none"
>
<view
class
=
"nav-item"
>
<image src=
"/images/logo.png"
></image>
<text
class
=
"nav-title"
>咖啡店</text>
</view>
<view
class
=
"nav-item"
>
<image src=
"/images/coffee.png"
></image>
<text
class
=
"nav-title"
>咖啡</text>
</view>
<view
class
=
"nav-item"
>
<image src=
"/images/drinks.png"
></image>
<text
class
=
"nav-title"
>饮品</text>
</view>
<view
class
=
"nav-item"
>
<image src=
"/images/desserts.png"
></image>
<text
class
=
"nav-title"
>甜点</text>
</view>
</navigator>
Page({
data: {
menuData: []
},
onLoad:
function
() {
var
that =
this
;
wx.request({
url:
'http://your-backend-server.com/menu'
,
success:
function
(res) {
that.setData({
menuData: res.data
})
}
})
}
})
Page({
data: {
currentMenu:
''
},
onLoad:
function
() {
var
that =
this
;
wx.request({
url:
'http://your-backend-server.com/getCurrentMenu'
,
success:
function
(res) {
that.setData({
currentMenu: res.data
})
}
})
},
onItemClick:
function
(event) {
console.log(
'菜单项被点击:'
, event.currentTarget.dataset.name)