Authored by 陈峰

Revert "fixed: 商品列表点击灵敏"

This reverts commit 15b8ccf9.
@@ -51,12 +51,7 @@ function GoodHrefBinding(el, binding) { @@ -51,12 +51,7 @@ function GoodHrefBinding(el, binding) {
51 href += `?openby:yohobuy=${JSON.stringify(goParams)}`; 51 href += `?openby:yohobuy=${JSON.stringify(goParams)}`;
52 } 52 }
53 el.href = href; 53 el.href = href;
54 -  
55 - if (el.tagName.toLowerCase() === 'span') {  
56 - el.dataset.url = href;  
57 - }  
58 } 54 }
59 -  
60 function BlkHrefBinding(el, binding) { 55 function BlkHrefBinding(el, binding) {
61 let value = binding.value; 56 let value = binding.value;
62 let protocol = value.match(/^(https?:)?\/\//); 57 let protocol = value.match(/^(https?:)?\/\//);
@@ -174,11 +169,6 @@ export default (Vue) => { @@ -174,11 +169,6 @@ export default (Vue) => {
174 bind: GoodHrefBinding, 169 bind: GoodHrefBinding,
175 update: GoodHrefBinding 170 update: GoodHrefBinding
176 }); 171 });
177 -  
178 - Vue.directive('good-link-url', {  
179 - bind: GoodHrefBinding,  
180 - update: GoodHrefBinding  
181 - });  
182 Vue.directive('blk-href', { 172 Vue.directive('blk-href', {
183 bind: BlkHrefBinding, 173 bind: BlkHrefBinding,
184 update: BlkHrefBinding 174 update: BlkHrefBinding
1 <template> 1 <template>
2 <div class="goods-box" v-infinite-scroll="fetch" infinite-scroll-disable="disableFetch" :infinite-scroll-distance="1200"> 2 <div class="goods-box" v-infinite-scroll="fetch" infinite-scroll-disable="disableFetch" :infinite-scroll-distance="1200">
3 <ul class="cardlist card-large clearfix"> 3 <ul class="cardlist card-large clearfix">
4 - <li class="card" v-for="(item, index) in data" :key="item.product_skn"> 4 + <li class="card" v-for="(item, index) in data" :key="item.product_skn" @click="clickProduct(item, index)">
5 <div class="card-pic"> 5 <div class="card-pic">
6 - <a-link v-good-link-url="item"> 6 + <a v-good-href="item">
7 <img v-img-src="{src: item.default_images, width: 330, height: 440}" :alt="item.product_name"> 7 <img v-img-src="{src: item.default_images, width: 330, height: 440}" :alt="item.product_name">
8 - </a-link> 8 + </a>
9 </div> 9 </div>
10 <div class="card-bd"> 10 <div class="card-bd">
11 <h2 class="card-label"> 11 <h2 class="card-label">
12 - <a-link v-good-link-url="item" class="line-clamp-1">{{item.product_name}}</a-link> 12 + <a v-good-href="item" class="line-clamp-1">{{item.product_name}}</a>
13 </h2> 13 </h2>
14 <h2 class="card-label-desc" v-if="item.product_name1"> 14 <h2 class="card-label-desc" v-if="item.product_name1">
15 - <a-link v-good-link-url="item" class="line-clamp-1">{{item.product_name}}</a-link> 15 + <a v-good-href="item" class="line-clamp-1">{{item.product_name}}</a>
16 </h2> 16 </h2>
17 <span class="good-price" :class="{'sale-price': item.market_price}">¥{{item.sales_price | toFixed}}</span> 17 <span class="good-price" :class="{'sale-price': item.market_price}">¥{{item.sales_price | toFixed}}</span>
18 <span class="good-price" :class="{'old-price': item.market_price}" v-if="item.market_price">¥{{item.market_price | toFixed}}</span> 18 <span class="good-price" :class="{'old-price': item.market_price}" v-if="item.market_price">¥{{item.market_price | toFixed}}</span>
@@ -31,7 +31,6 @@ @@ -31,7 +31,6 @@
31 </template> 31 </template>
32 <script> 32 <script>
33 import Vue from 'vue'; 33 import Vue from 'vue';
34 - import aLink from 'component/tool/a-link.vue';  
35 import lazyload from 'vue-lazyload'; 34 import lazyload from 'vue-lazyload';
36 import infinitScroll from 'vue-infinite-scroll'; 35 import infinitScroll from 'vue-infinite-scroll';
37 import bus from 'common/vue-bus'; 36 import bus from 'common/vue-bus';
@@ -58,10 +57,10 @@ @@ -58,10 +57,10 @@
58 methods: { 57 methods: {
59 fetch: function() { 58 fetch: function() {
60 bus.$emit('list.paging'); 59 bus.$emit('list.paging');
61 - }  
62 }, 60 },
63 - components: {  
64 - aLink 61 + clickProduct(item, index) {
  62 + this.$emit('click-product', item, index);
  63 + }
65 } 64 }
66 }; 65 };
67 66
1 -<template>  
2 - <v-touch tag="span" @tap="click">  
3 - <slot></slot>  
4 - </v-touch>  
5 -</template>  
6 -  
7 -<script>  
8 - import yoho from 'yoho';  
9 - import parse from 'yoho-qs/parse';  
10 -  
11 - export default {  
12 - name: 'ALink',  
13 - props: {  
14 - href: [String]  
15 - },  
16 - methods: {  
17 - click() {  
18 - let goodUrl = this.$el.dataset['url'];  
19 -  
20 - if (goodUrl) {  
21 - let url = goodUrl;  
22 - const classList = this.$el.classList;  
23 - const excluded = classList.contains('no-intercept');  
24 -  
25 - if (excluded) {  
26 - location.href = this.href;  
27 - return;  
28 - }  
29 -  
30 - if (/^\/\//.test(url)) {  
31 - url = 'http:' + url;  
32 - }  
33 -  
34 - this.dispatch(url);  
35 - return false;  
36 - }  
37 - },  
38 - dispatch(url) {  
39 - const origin = location.origin;  
40 - const defaultTitleMap = {  
41 - 1: {  
42 - headerid: '1',  
43 - left: {  
44 - action: ''  
45 - },  
46 - title: {  
47 - des: '',  
48 - action: ''  
49 - }  
50 - },  
51 - 2: {  
52 - headerid: '2',  
53 - left: {  
54 - action: ''  
55 - },  
56 - title: {  
57 - des: '',  
58 - action: ''  
59 - },  
60 - right: {  
61 - icon: 'chat',  
62 - action: 'goToService'  
63 - }  
64 - },  
65 - 3: {  
66 - headerid: '3',  
67 - left: {  
68 - action: ''  
69 - },  
70 - title: {  
71 - des: '',  
72 - action: ''  
73 - },  
74 - right: {  
75 - des: '提交',  
76 - action: 'test'  
77 - }  
78 - },  
79 - 4: {  
80 - headerid: '4',  
81 - ltitle: {  
82 - des: '品牌',  
83 - action: origin + '/brands'  
84 - },  
85 - rtitle: {  
86 - des: '品类',  
87 - action: origin + '/cate'  
88 - }  
89 - },  
90 - 5: {  
91 - headerid: '5',  
92 - left: {  
93 - action: ''  
94 - },  
95 - ltitle: {  
96 - des: '商品',  
97 - action: origin + '/me/collection'  
98 - },  
99 -  
100 - // mtitle: {  
101 - // des: '品牌',  
102 - // action: origin + '/me/collection?tab=brand'  
103 - // },  
104 - rtitle: {  
105 - des: '资讯',  
106 - action: origin + '/me/collection?tab=article'  
107 - },  
108 - right: {  
109 - des: '编辑',  
110 - action: 'editModel'  
111 - },  
112 - defaultSelectedIndex: '0'  
113 - },  
114 - 6: {  
115 - headerid: '6',  
116 - title: {  
117 - des: '资讯',  
118 - action: ''  
119 - }  
120 - }  
121 - };  
122 -  
123 - if (yoho.isApp || yoho.isYohoBuy) {  
124 - let titleMap = Object.assign({}, defaultTitleMap);  
125 - let [path, qs] = url.split('?');  
126 -  
127 - qs = parse(qs);  
128 -  
129 - // 个人中心收藏  
130 - if (/\/me\/collection$/.test(path)) {  
131 - let header = titleMap[5];  
132 -  
133 - if (qs.tab === 'article') {  
134 - header.defaultSelectedIndex = '1';  
135 - } else {  
136 - header.defaultSelectedIndex = '0';  
137 - }  
138 - return yoho.goPageView({  
139 - header: header  
140 - });  
141 - }  
142 -  
143 - // 个人中心首页  
144 - if (/\/me$/.test(path)) {  
145 - return yoho.goTab({  
146 - index: 4  
147 - });  
148 - }  
149 -  
150 - // 资讯  
151 - if (/\/editorial\/list$/.test(path)) {  
152 - return yoho.goTab({  
153 - index: 2  
154 - });  
155 - }  
156 -  
157 - // 品类  
158 - if (/\/cate$/.test(path)) {  
159 - return yoho.goTab({  
160 - index: 1,  
161 - headerIndex: 1  
162 - });  
163 - }  
164 -  
165 - // 首页  
166 - if (/\/$/.test(path) || !path) {  
167 - return yoho.goTab({  
168 - index: 0,  
169 - url: /^(https?:)?\/\//i.test(url) ? url : origin + url  
170 - });  
171 - }  
172 -  
173 - const args = {  
174 - url: /^(https?:)?\/\//i.test(url) ? url : origin + url  
175 - };  
176 -  
177 - if (/\/me\/service$/.test(path)) {  
178 - args.showLoading = 'no';  
179 - }  
180 -  
181 - // 处理 feature.yoho.cn 等域名下的站外链接  
182 - if (/^(https?:)?\/\//i.test(path) && !/m\.yohoblk\.com/.test(path)) {  
183 - args.showLoading = 'no';  
184 - }  
185 - args.header = {  
186 - headerid: '-1'  
187 - };  
188 - yoho.goNewPage(args);  
189 - } else {  
190 - location.href = url;  
191 - }  
192 - }  
193 - }  
194 - };  
195 -</script>  
196 -  
197 -<style>  
198 -  
199 -</style>