unescape
发布于 5 年前 作者 guiyinggao 3572 次浏览 来自 问答

picPath: function (path, is_hfs) {

    if (typeof path != ‘undefined’ && path != ‘’) {

        path = unescape(path);

        if (is_hfs) {

            let arr = path.split(’/’);

            if (is_hfs == 1) {

                arr[arr.length - 1] = ‘sl_’ + arr.pop();

            } else if (is_hfs == 2) {

                arr[arr.length - 1] = ‘ssl_’ + arr.pop();

            }

        path = arr.join(’/’);

        }

    }

    return path;

},

在页面中使用

<image src="{{filter.picPath(item.pic)}}"></image>

报错

Uncaught ReferenceError: unescape is not defined

(anonymous)

怎么使用unescape

2 回复

wxs中不支持unescape,请使用decodeURIComponent。

请阅读wxs文档https://developers.weixin.qq.com/miniprogram/dev/framework/view/wxs/07basiclibrary.html

你好 我试了一下这边unescape是可用的,能不能提供一下代码片段。https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

回到顶部