Home >Web Front-end >JS Tutorial >The first lesson explaining the basics of WeChat mini program development
1. 9*9 multiplication table
test.wxml
91075e844c5f01ec37a80a3b60d29579 c44273fc38ab15dbaeefc488ca3abb58 4736deec9a1dc4391a863f56d2e38c66 {{i}}*{{j}}={{i*j}} de5f4c1163741e920c998275338d29b2 de5f4c1163741e920c998275338d29b2 de5f4c1163741e920c998275338d29b2
test.wxss
.con{ font-size:8px; }
Running result:
2. Window scrolling
XX.wxml
<scroll-view class='aa' scroll-y="ture"> <view class="a"> 1 </view> <view class="b"> 2 </view> <view class="c"> 3 </view> </scroll-view>
XX.wxss
/* pages/news/news.wxss */ .aa{ width:200px; height: 100px; } .a{ height: 200rpx; background-color: red; } .b{ height: 200rpx; background-color: gold; } .c{ height: 200rpx; background-color: green; }
This example is vertical scrolling
Type | Default value | Description | |
---|---|---|---|
Boolean | false | Allow horizontal scrolling | |
Boolean | false | Allow vertical scrolling | |
Number | 50 | How far away from the top/left (unit px) is the scrolltoupper event triggered | |
Number | 50 | How far away from the bottom/right (unit px) is the scrolltolower event triggered | |
Number | Set the vertical scroll bar position | ||
Number | Set the horizontal scroll bar position | ||
String | The value should be the id of a certain sub-element, then scroll to the element, and the top of the element will be aligned and scrolled Top of area | ||
EventHandle | Scroll to the top/left, the scrolltoupper event will be triggered | ||
EventHandle | Scroll to the bottom/right, the scrolltolower event will be triggered | ||
EventHandle | Triggered when scrolling, event.detail = {scrollLeft, scrollTop, scrollHeight, scrollWidth, deltaX, deltaY} |
f22ed720d2ae070222ab6f087b345d61 a fixed height and set the height through WXSS.
XX.wxml
<swiper indicator-dots="ture" autoplay="ture" interval="1000" duration="1000"> <block wx:for="{{imgUrls}}"> <swiper-item> <image src='{{item}}'></image> </swiper-item> </block> </swiper>
XX.js
imgUrls:[ "../image/1.png", "../image/2.png", "../image/3.png" ],
Related knowledge points
Type | Default value | Instruction | |
---|---|---|---|
Boolean | false | Whether to display the panel indicator point | |
Boolean | false | Whether to automatically switch | |
Number | 0 | The index of the current page | |
Number | 5000 | Automatic switching interval | |
Number | 1000 | Sliding animation duration | |
EventHandle | The change event will be triggered when current changes, event.detail = {current: current} |
The above is the detailed content of The first lesson explaining the basics of WeChat mini program development. For more information, please follow other related articles on the PHP Chinese website!