Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mini-program-wepy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
mini-program-wepy
Commits
93df788d
Commit
93df788d
authored
Jun 15, 2020
by
ziyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 代码暂存
parent
dbfc7724
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
15 deletions
+15
-15
common.wxs
src/common/common.wxs
+4
-8
goodsList.wpy
src/components/custom/goodsList.wpy
+10
-6
index.wpy
src/pages/index.wpy
+1
-1
No files found.
src/common/common.wxs
View file @
93df788d
function computClass (current,index,length) {
function computClass (current,index,length
,circular
) {
var allclass = "";
// 无限循环当current为最后一个的时候,select就应该是0 例如长度为10,当current为9时,select就应该是0
// if(current+1==index || (current==length-1 && index==0) ) allclass = "select";
// 无限循环当current为最后一个/两个的时候的时候,例如长度为10,当current为8/9时,select就应该是1/0
//if(current+2 == index|| (current>=length-2 && index==current-length+2))
//allclass='subright';
if(current-1 == index||(current == 0&&index==length-1))
//只有当无限循环的时候,才需要考虑末端的情况就是当current为0时,length-1在他的左边
if(current-1 == index || ( circular && current == 0 && index==length-1))
allclass='subleft';
if(current==index)
allclass='select';
if(current+1==index || (current==length-1 && index==0) )
if(current+1==index || (
circular &&
current==length-1 && index==0) )
allclass = "subright";
return allclass;
};
...
...
src/components/custom/goodsList.wpy
View file @
93df788d
...
...
@@ -18,7 +18,7 @@
data-itemid="{{index}}"
bindtap="toViewPage"
data-item="{{item}}"
class="list-item {{item.select?'delete':''}} {{tools.computClass(currentIndex,index,list.length)}}"
class="list-item {{item.select?'delete':''}} {{tools.computClass(currentIndex,index,list.length
,circular
)}}"
bindtouchstart="touchStart"
bindtouchend="touchEnd"
>
...
...
@@ -44,8 +44,8 @@
},
data: {
swiperItem: 2,
current:
5
,
currentIndex:
5
, // 商品当前滑动到第几个
current:
1
,
currentIndex:
1
, // 商品当前滑动到第几个
circular: false, // 商品是否无限循环
topPage: 0,
lastPage: 0,
...
...
@@ -65,7 +65,7 @@
{value: 14, text: '白色条纹马克杯,马克吐温同款14', imgsrc: '/static/images/peo2.jpg', price: '¥599.20', people: 2200, sku: '100004549235'},
{value: 15, text: '白色条纹马克杯,马克吐温同款15', imgsrc: '/static/images/peo3.jpg', price: '¥2399.01', people: 2200, sku: '100004549235'},{value: 11, text: '白色条纹马克杯,马克吐温同款11', imgsrc: '/static/images/test1.jpg', price: '¥9.89', people: 2200, sku: '100004549235'},
{value: 12, text: '白色条纹马克杯,马克吐温同款12', imgsrc: '/static/images/test2.png', price: '¥19.20', people: '2200', sku: '100004549235'},
]
]
;
},
methods: {
moveSwiper(e) {
...
...
@@ -200,18 +200,22 @@
if (list.length <= 4) {
this.circular = false;
}
console.log(current.itemid,this.currentIndex,this.current,111)
if (current.itemid >= list.length - 1) {
this.current = this.currentIndex - 1;
}
setTimeout(function() {
let newlist = that.list.filter((item, index) => index !== +current.itemid);
// that.current = Math.max(that.current - 1, 0);
// 正常情况下,current.itemid都会比current大一个,当相等或小于的时候就有问题,要重新设置current,最小不能超过0
if(newlist.length <= that.swiperItem) {
that.swiperItem = newlist.length;
}
that.list = newlist;
if (current.itemid - that.current !==1 ) {
that.current = Math.max(that.current - 1, 0);
}
console.log(that.current,current.itemid,11)
//删除完成之后
console.log(current.itemid,that.currentIndex,that.current,222)
}, 500);
}
}
...
...
src/pages/index.wpy
View file @
93df788d
...
...
@@ -168,7 +168,7 @@
<shared-popup v-if="showModal === 1" :inviteinfo="mainInfo && mainInfo.inviteRecord" @getSharedGold="getSharedGold"/>
<popup @showMenu="showMenu" :showMenus="showModal === 3"/>
<!--商品推荐列表-->
<
goods-list></goods-list
>
<
!--<goods-list></goods-list>--
>
<van-dialog id="van-dialog"/>
<van-notify id="van-notify"/>
<van-popup show="{{ cornModal }}" bind:close="cornModalClose" custom-style="background-color:transparent">
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment