wxml:
<
view
class=
"nav_item"
bindtap=
"navFn"
data-mode=
"{{item.mode}}"
data-index=
"{{index}}">
<
view
class=
"item_img"><
image
class=
"item_icon"
src=
"{{item.pic_address}}"
/
></
view
>
<
view
class=
"item_text"><
text
>{{item.columname}}
</
text
></
view
>
</
view
>
js:
navFn:
function (e) {
var mode = e.currentTarget.dataset.mode;
var index = e.currentTarget.dataset.index;
if (mode ==
1) {
this.calling()
};
var url =
this.data.listnav[index].link_address;
console.log(url, mode)
if (mode ==
2) {
wx.switchTab({
url: url,
})
};
var url =
this.data.listnav[index].link_address;
console.log(
this.data.listNav)
if (mode ==
3) {
wx.navigateTo({
url: url,
})
};
},
calling:
function () {
wx.makePhoneCall({
phoneNumber:
'400000000',
//此号码并非真实电话号码,仅用于测试
success:
function () {
console.log(
"拨打电话成功!")
},
fail:
function () {
console.log(
"拨打电话失败!")
}
})
},
wx.request({
url:
'http://weixin.4000428110.com/admin.php/column00/index',
//导航八个项目
success:
function (res) {
console.log(res.data.data)
that.setData({
listnav: res.data.data
})