收藏
回答

官方推荐useExtendedLib 扩展库方式引入weui组件失败,完全按照文档来的,缺了什么吗?

引入流程:

1、编辑app.json,添加:

"useExtendedLib": {
  "weui"true
}

2、编辑页面的json文件,如下:

{
  "usingComponents": {
    "mp-dialog": "weui-miniprogram/dialog/dialog"
  }
}

3、编辑页面wxml文件,如下:

<mp-dialog title="test" show="{{true}}" bindbuttontap="tapDialogButton" buttons="{{[{text: '取消'}, {text: '确认'}]}}">
    <view>test content</view>
</mp-dialog>

4、编译报错,异常栈如下:

[渲染层错误] TypeError: Cannot read property 'replace' of undefined
    at rewritor (http://127.0.0.1:56450/__pageframe__/__extendedlib__/weui/latest/pageframe.js:176:44)
    at http://127.0.0.1:56450/__pageframe__/__extendedlib__/weui/latest/pageframe.js:194:127
[渲染层错误] webviewScriptError
Cannot read property 'replace' of undefined
TypeError: Cannot read property 'replace' of undefined
    at rewritor (http://127.0.0.1:56450/__pageframe__/__extendedlib__/weui/latest/pageframe.js:176:44)
    at http://127.0.0.1:56450/__pageframe__/__extendedlib__/weui/latest/pageframe.js:194:127
[渲染层错误] Uncaught TypeError: Cannot read property 'replace' of undefined
[渲染层错误] TypeError: t is not a function
    at _ (http://127.0.0.1:56450/__pageframe__/__dev__/WAWebview.js:19:29802)
    at Function.A [as create] (http://127.0.0.1:56450/__pageframe__/__dev__/WAWebview.js:19:29936)
    at Function.p.prepare (http://127.0.0.1:56450/__pageframe__/__dev__/WAWebview.js:6:14825)
    at Function.p._advancedCreate (http://127.0.0.1:56450/__pageframe__/__dev__/WAWebview.js:6:15474)
    at l.createComponent (http://127.0.0.1:56450/__pageframe__/__dev__/WAWebview.js:6:22629)
    at e.value (http://127.0.0.1:56450/__pageframe__/__dev__/WAWebview.js:20:1882)
    at http://127.0.0.1:56450/__pageframe__/__dev__/WAWebview.js:20:3031
    at Array.forEach ()
    at e.value (http://127.0.0.1:56450/__pageframe__/__dev__/WAWebview.js:20:3003)
    at e.value (http://127.0.0.1:56450/__pageframe__/__dev__/WAWebview.js:19:30482)
[渲染层错误] exparserScriptError
t is not a function
TypeError: t is not a function
    at _ (http://127.0.0.1:56450/__pageframe__/__dev__/WAWebview.js:19:29802)
    at Function.A [as create] (http://127.0.0.1:56450/__pageframe__/__dev__/WAWebview.js:19:29936)
    at Function.p.prepare (http://127.0.0.1:56450/__pageframe__/__dev__/WAWebview.js:6:14825)
    at Function.p._advancedCreate (http://127.0.0.1:56450/__pageframe__/__dev__/WAWebview.js:6:15474)
    at l.createComponent (http://127.0.0.1:56450/__pageframe__/__dev__/WAWebview.js:6:22629)
    at e.value (http://127.0.0.1:56450/__pageframe__/__dev__/WAWebview.js:20:1882)
    at http://127.0.0.1:56450/__pageframe__/__dev__/WAWebview.js:20:3031
    at Array.forEach ()
    at e.value (http://127.0.0.1:56450/__pageframe__/__dev__/WAWebview.js:20:3003)
    at e.value (http://127.0.0.1:56450/__pageframe__/__dev__/WAWebview.js:19:30482)
[渲染层错误] TypeError: Cannot read property 'replace' of undefined
    at rewritor (http://127.0.0.1:56450/__pageframe__/__extendedlib__/weui/latest/pageframe.js:176:44)
    at http://127.0.0.1:56450/__pageframe__/__extendedlib__/weui/latest/pageframe.js:194:127
[渲染层错误] webviewScriptError
Cannot read property 'replace' of undefined
TypeError: Cannot read property 'replace' of undefined
    at rewritor (http://127.0.0.1:56450/__pageframe__/__extendedlib__/weui/latest/pageframe.js:176:44)
    at http://127.0.0.1:56450/__pageframe__/__extendedlib__/weui/latest/pageframe.js:194:127
[渲染层错误] Uncaught TypeError: Cannot read property 'replace' of undefined


是我操作不对还是文档缺失?或者与工具版本有关?我是稳定最新版,版本号为1.03.2011120,已看到有其他人遇到相同问题没有人回复。

最后一次编辑于  2020-12-29
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容
问题标签