<block wx:for-items="{{movies}}" wx:key="key">
<swiper-item>
<image src="{{item.url}}" class="slide-image" mode="aspectFill" />
swiper-item>
block>
data: {
movies: [
{ url: 'https://img1.baidu.com/it/u=1361135963,570304265&fm=26&fmt=auto&gp=0.jpg' },
{ url: 'https://img2.baidu.com/it/u=3206689113,2237998950&fm=26&fmt=auto&gp=0.jpg' }
]
},
view
<view class='container'>
<view>666view>
<view>666view>
view>
css
.container{
border: 2rpx solid red;
width: 500rpx;
height: 200rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
<button bindtap='jump_page'>实现跳转页面button>
// 跳转页面
jump_page() {
wx.navigateTo({
url: '/pages/info/info',
})
},
<view bindtap="btn" bindlongpress="longpress" >
66666666666
view>
// 长按进入函数
longpress(){
console.log("长按")
},
// 单词点击进入
btn(){
console.log("进入")
},
wx.showToast({
image: '../../images/toast/success.png',
title: "发送成功",
})
setTimeout(function () {
//要延时执行的代码
}, 2000) //延迟时间 这里是2秒
wx.redirectTo({
url: '../chooseLib/chooseLib',
})
wx.navigateTo({
url: '/pages/perInfo/perInfo',
})
跳转tabBar专用
wx.switchTab({
url: '/pages/scan/scan'
});
wxml
bindtap="catchTapCategory" data-isbn="{{item.isbn}}" data-id="{{item.id}}"
js
catchTapCategory: function (e) {
var id = e.currentTarget.dataset._id
var isbn = e.currentTarget.dataset.isbn
wx: wx.navigateTo({
url: 'return1/return1?id=' + id + "&isbn=" + isbn
})
},
https://www.couragesteak.com/article/236