当前位置:网站首页>Wechat applet 02 - Implementation of rotation map and picture click jump
Wechat applet 02 - Implementation of rotation map and picture click jump
2022-07-01 15:12:00 【Skipping Wang Xiaozhe】
Realization effect :
Preface
In a small program 01 in , I have learned how to make the bottom navigation bar , In this section, let's learn how to make a carousel map , And click the carousel map to complete the page Jump .
Implementation process
notes :(1) Early learning , I use local pictures here , Later on , It can connect with the back-end interface , Get data dynamically , Easy to learn in the early stage , Just use the local pictures for the time being .(2) About picture jump address , Because other pages have not been written in the early stage , So what I jump here is switching Tab, If there is a return jump link in the later data , Can be removed navigator In the tag open-type="switchTab" attribute .
1 stay index.wxml In file , Add the following code :
<!-- Head advertisement diagram -->
<swiper class="top-banner" indicator-dots="{
{indicatorDots}}" autoplay="{
{autoplay}}" interval="{
{interval}}" duration="{
{duration}}">
<block wx:for="{
{images_list}}" wx:key="id">
<navigator url="{
{item.link}}" open-type="switchTab">
<swiper-item >
<image src="{
{item.image_url}}" class="slide-image"></image>
</swiper-item>
</navigator>
</block>
</swiper>
2 stay index.wxss Add the style of rotation chart in the file
.top-banner {
width: 100%;
height: 360rpx;
}
.slide-image {
width: 100%;
height: 100%;
}
3, stay index.js In file increase data Parameters
Page({
data: {
autoplay: true,
indicatorDots: true,
interval: 3000,
duration: 1200,
images_list : [
{
"id": 1,
"image_url": "../../images/banner1.jpg",
"link": "../list/list"
},
{
"id": 2,
"image_url": "../../images/banner2.jpg",
"link": "../mine/mine"
},
],
},
// Event handler
bindViewTap() {
wx.navigateTo({
url: '../logs/logs',
})
},
onLoad() {
},
})
The pit of tread
Follow the online tutorial , Add a jump link to the picture ( Here's the picture ), Picture not shown .
There is less documentation on this issue , One of them said ,navigator The label on the swiper-item Outside the label , So I tried , The code is changed to the following figure :
Then the rotation chart can be displayed normally .
边栏推荐
- 网速、宽带、带宽、流量三者之间的关系是什么?
- Apk signature principle
- Solidty智能合约开发-简易入门
- Mongodb second call -- implementation of mongodb high availability cluster
- It's suitable for people who don't have eloquence. The benefits of joining the China Video partner program are really delicious. One video gets 3 benefits
- Flink 系例 之 TableAPI & SQL 与 MYSQL 数据查询
- JVM第二话 -- JVM内存模型以及垃圾回收
- TypeScript:var
- DirectX修复工具V4.1公测![通俗易懂]
- [leetcode] 16. The sum of the nearest three numbers
猜你喜欢
随机推荐
定了!2022海南二级造价工程师考试时间确定!报名通道已开启!
Basic operation of database
Guide de conception matérielle du microcontrôleur s32k1xx
cmake 基本使用过程
Introduction to MySQL audit plug-in
厦门灌口镇田头村特色农产品 甜头村特色农产品蚂蚁新村7.1答案
基于价值量化的需求优先级排序方法
MongoDB第二话 -- MongoDB高可用集群实现
TypeScript: let
How to realize clock signal frequency division?
MySQL service is starting. MySQL service cannot be started. Solution
微服务追踪SQL(支持Isto管控下的gorm查询追踪)
点云重建方法汇总一(PCL-CGAL)
Intelligent operation and maintenance practice: banking business process and single transaction tracking
The difference between arrow function and ordinary function in JS
[antenna] [3] some shortcut keys of CST
Internet hospital system source code hospital applet source code smart hospital source code online consultation system source code
ArrayList 扩容详解,扩容原理[通俗易懂]
The first word of JVM -- detailed introduction to JVM and analysis of runtime data area
[leetcode] 16. The sum of the nearest three numbers