Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohoblk-wap
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
陈峰
8 years ago
Commit
f2b3f7e9f8d711878e327d350e1956f5bddba4fa
1 parent
f3e30f43
Revert "fixed: 商品列表点击灵敏"
This reverts commit
15b8ccf9
.
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
218 deletions
public/js/common/vue-directive.js
public/vue/component/product/list.vue
public/vue/component/tool/a-link.vue
public/js/common/vue-directive.js
View file @
f2b3f7e
...
...
@@ -51,12 +51,7 @@ function GoodHrefBinding(el, binding) {
href
+=
`
?
openby
:
yohobuy
=
$
{
JSON
.
stringify
(
goParams
)}
`
;
}
el
.
href
=
href
;
if
(
el
.
tagName
.
toLowerCase
()
===
'span'
)
{
el
.
dataset
.
url
=
href
;
}
}
function
BlkHrefBinding
(
el
,
binding
)
{
let
value
=
binding
.
value
;
let
protocol
=
value
.
match
(
/^
(
https
?
:
)?\/\/
/
);
...
...
@@ -174,11 +169,6 @@ export default (Vue) => {
bind
:
GoodHrefBinding
,
update
:
GoodHrefBinding
});
Vue
.
directive
(
'good-link-url'
,
{
bind
:
GoodHrefBinding
,
update
:
GoodHrefBinding
});
Vue
.
directive
(
'blk-href'
,
{
bind
:
BlkHrefBinding
,
update
:
BlkHrefBinding
...
...
public/vue/component/product/list.vue
View file @
f2b3f7e
<template>
<div class="goods-box" v-infinite-scroll="fetch" infinite-scroll-disable="disableFetch" :infinite-scroll-distance="1200">
<ul class="cardlist card-large clearfix">
<li class="card" v-for="(item, index) in data" :key="item.product_skn">
<li class="card" v-for="(item, index) in data" :key="item.product_skn"
@click="clickProduct(item, index)"
>
<div class="card-pic">
<a
-link v-good-link-url
="item">
<a
v-good-href
="item">
<img v-img-src="{src: item.default_images, width: 330, height: 440}" :alt="item.product_name">
</a
-link
>
</a>
</div>
<div class="card-bd">
<h2 class="card-label">
<a
-link v-good-link-url="item" class="line-clamp-1">{{item.product_name}}</a-link
>
<a
v-good-href="item" class="line-clamp-1">{{item.product_name}}</a
>
</h2>
<h2 class="card-label-desc" v-if="item.product_name1">
<a
-link v-good-link-url="item" class="line-clamp-1">{{item.product_name}}</a-link
>
<a
v-good-href="item" class="line-clamp-1">{{item.product_name}}</a
>
</h2>
<span class="good-price" :class="{'sale-price': item.market_price}">¥{{item.sales_price | toFixed}}</span>
<span class="good-price" :class="{'old-price': item.market_price}" v-if="item.market_price">¥{{item.market_price | toFixed}}</span>
...
...
@@ -31,7 +31,6 @@
</template>
<script>
import Vue from 'vue';
import aLink from 'component/tool/a-link.vue';
import lazyload from 'vue-lazyload';
import infinitScroll from 'vue-infinite-scroll';
import bus from 'common/vue-bus';
...
...
@@ -58,10 +57,10 @@
methods: {
fetch: function() {
bus.$emit('list.paging');
},
clickProduct(item, index) {
this.$emit('click-product', item, index);
}
},
components: {
aLink
}
};
...
...
public/vue/component/tool/a-link.vue
deleted
100644 → 0
View file @
f3e30f4
<template>
<v-touch tag="span" @tap="click">
<slot></slot>
</v-touch>
</template>
<script>
import yoho from 'yoho';
import parse from 'yoho-qs/parse';
export default {
name: 'ALink',
props: {
href: [String]
},
methods: {
click() {
let goodUrl = this.$el.dataset['url'];
if (goodUrl) {
let url = goodUrl;
const classList = this.$el.classList;
const excluded = classList.contains('no-intercept');
if (excluded) {
location.href = this.href;
return;
}
if (/^\/\//.test(url)) {
url = 'http:' + url;
}
this.dispatch(url);
return false;
}
},
dispatch(url) {
const origin = location.origin;
const defaultTitleMap = {
1: {
headerid: '1',
left: {
action: ''
},
title: {
des: '',
action: ''
}
},
2: {
headerid: '2',
left: {
action: ''
},
title: {
des: '',
action: ''
},
right: {
icon: 'chat',
action: 'goToService'
}
},
3: {
headerid: '3',
left: {
action: ''
},
title: {
des: '',
action: ''
},
right: {
des: '提交',
action: 'test'
}
},
4: {
headerid: '4',
ltitle: {
des: '品牌',
action: origin + '/brands'
},
rtitle: {
des: '品类',
action: origin + '/cate'
}
},
5: {
headerid: '5',
left: {
action: ''
},
ltitle: {
des: '商品',
action: origin + '/me/collection'
},
// mtitle: {
// des: '品牌',
// action: origin + '/me/collection?tab=brand'
// },
rtitle: {
des: '资讯',
action: origin + '/me/collection?tab=article'
},
right: {
des: '编辑',
action: 'editModel'
},
defaultSelectedIndex: '0'
},
6: {
headerid: '6',
title: {
des: '资讯',
action: ''
}
}
};
if (yoho.isApp || yoho.isYohoBuy) {
let titleMap = Object.assign({}, defaultTitleMap);
let [path, qs] = url.split('?');
qs = parse(qs);
// 个人中心收藏
if (/\/me\/collection$/.test(path)) {
let header = titleMap[5];
if (qs.tab === 'article') {
header.defaultSelectedIndex = '1';
} else {
header.defaultSelectedIndex = '0';
}
return yoho.goPageView({
header: header
});
}
// 个人中心首页
if (/\/me$/.test(path)) {
return yoho.goTab({
index: 4
});
}
// 资讯
if (/\/editorial\/list$/.test(path)) {
return yoho.goTab({
index: 2
});
}
// 品类
if (/\/cate$/.test(path)) {
return yoho.goTab({
index: 1,
headerIndex: 1
});
}
// 首页
if (/\/$/.test(path) || !path) {
return yoho.goTab({
index: 0,
url: /^(https?:)?\/\//i.test(url) ? url : origin + url
});
}
const args = {
url: /^(https?:)?\/\//i.test(url) ? url : origin + url
};
if (/\/me\/service$/.test(path)) {
args.showLoading = 'no';
}
// 处理 feature.yoho.cn 等域名下的站外链接
if (/^(https?:)?\/\//i.test(path) && !/m\.yohoblk\.com/.test(path)) {
args.showLoading = 'no';
}
args.header = {
headerid: '-1'
};
yoho.goNewPage(args);
} else {
location.href = url;
}
}
}
};
</script>
<style>
</style>
Please
register
or
login
to post a comment