Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

图片手动上传,已上传图片点击后不显示问题,应该是url处理问题,我用了笨办法临时替换,暂时可用,请修复 #116

Closed
hixiaoguan opened this issue Apr 27, 2017 · 2 comments

Comments

@hixiaoguan
Copy link

hixiaoguan commented Apr 27, 2017

临时用笨办法做了替换

原来是这样的
background-image:url(" blob:http:="" 192.168.1.108:801="" c3cd3f26-7b21-4ba6-b26e-06667c5950b1")"=""
修改了一下代码后:
background-image:url(blob:http://192.168.1.108:801/c3cd3f26-7b21-4ba6-b26e-06667c5950b1)"
问题临时解决。

解决办法分享给道友:

打开weui.js v1.1.1,找到3458行添加如下代码:

$gallery[0].innerHTML = $gallery[0].innerHTML.replace('" blob:http:="" ','blob:http://');
$gallery[0].innerHTML = $gallery[0].innerHTML.replace('=" "="" ','/');
$gallery[0].innerHTML = $gallery[0].innerHTML.replace(')"=""',')"');

或者找到gallery(url)方法,替换下面的内容即可

function gallery(url) {
	    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

	    if (_sington) return _sington;

	    options = _util2.default.extend({
	        className: '',
	        onDelete: _util2.default.noop
	    }, options);

	    var $gallery = (0, _util2.default)(_util2.default.render(_gallery2.default, _util2.default.extend({
	        url: url
	    }, options)));
		//小官调整weui.js手动上传图片删除图片时图片路径不正确BUG
		$gallery[0].innerHTML = $gallery[0].innerHTML.replace('" blob:http:="" ','blob:http://');
		$gallery[0].innerHTML = $gallery[0].innerHTML.replace('=" "="" ','/');
		$gallery[0].innerHTML = $gallery[0].innerHTML.replace(')"=""',')"');
		//console.log('XIAOGUAN:',$gallery);
		//小官调整结束
	    function _hide(callback) {
	        _hide = _util2.default.noop; // 防止二次调用导致报错

	        $gallery.addClass('weui-animate-fade-out').on('animationend webkitAnimationEnd', function () {
	            $gallery.remove();
	            _sington = false;
	            callback && callback();
	        });
	    }
	    function hide(callback) {
	        _hide(callback);
	    }

	    (0, _util2.default)('body').append($gallery);
	    $gallery.find('.weui-gallery__img').on('click', function () {
	        hide();
	    });
	    $gallery.find('.weui-gallery__del').on('click', function () {
	        options.onDelete.call(this, url);
	    });

	    $gallery.show().addClass('weui-animate-fade-in');

	    _sington = $gallery[0];
	    _sington.hide = hide;
	    return _sington;
	}
@BearJ
Copy link
Collaborator

BearJ commented May 3, 2017

好的,谢谢建议~

@BearJ
Copy link
Collaborator

BearJ commented Jul 18, 2017

v.1.1.2 优化

@BearJ BearJ closed this as completed Jul 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants