自定义属性商品详情页无法取消选中属性

bug问题 · chenchaojie · 于 6年前 发布 · 1805 次阅读

问题涉及h5与pc端 vendor/fancyecommerce/fecshop/app/appfront/theme/base/front/catalog/product/index/custom_option.php:53 vendor/fancyecommerce/fecshop/app/apphtml5/theme/base/html5/catalog/product/index/custom_option.php:54 这里只列出pc代码

	if(!$(this).hasClass('no_active')){
			$chosen_custom_option_arr = [];
			$(this).parent().parent().find("a").removeClass("current");
			$(this).parent().parent().find("li").removeClass("current");
			$(this).addClass("current");
			$(this).parent().addClass("current");
			$(this).parent().parent().removeClass("no_chosen_ul");
			$(this).parent().parent().addClass("chosen_ul");
			$chosen_attr = [];
			

我的优化

  if (!$(this).hasClass('no_active')) {
                if ($(this).hasClass("current")) {
                    $(this).removeClass("current");
                    $(this).parent().removeClass("current");
                    $(this).parent().parent().removeClass("chosen_ul");
                    $(this).parent().parent().addClass("no_chosen_ul");
                } else {
                    $(this).parent().parent().find("a").removeClass("current");
                    $(this).parent().parent().find("li").removeClass("current");
                    $(this).addClass("current");
                    $(this).parent().addClass("current");
                    $(this).parent().parent().removeClass("no_chosen_ul");
                    $(this).parent().parent().addClass("chosen_ul");
                }
				
共收到 4 条回复 技术分享
Fecmall#16年前 0 个赞

譬如产品页面:https://fecshop.appfront.fancyecommerce.com/reindeer-pattern-glitter-christmas-dress-86519596

您的意思是点击第一次是选中,继续点击同一个自定义属性的值,代表取消选中?

譬如:我点击了My Size 的M,我如果再次点击size M,就取消刚才的选中,结果就是: My Size: 这一行,没有任何一个尺码是被选中的

是这个意思吧?

chenchaojie#26年前 0 个赞

是的

Fecmall#36年前 0 个赞

@chenchaojie #2楼 OK,先记录一下

Fecmall#46年前 0 个赞

如果您使用vue端,那么需要更新下这部分:https://github.com/fecshop/vue_fecshop_appserver/commit/d5c33bf55e75dfa5f84efa7468268b4fd83988c0

vue取消选中的功能已经更新。

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics