uniapp报$gwx is not a function错误

  • 2019 年 11 月 6 日
  • 筆記

最近在做uniapp应用时遇到一个错误,记录一下

运行到手机时的错误信息:

[错误] ./pages/tabBar/do_diagnosis/do_diagnosis.wxml:1:4575: unexpected character `�`  12:27:14.960 [错误] ./pages/tabBar/do_diagnosis/do_diagnosis.wxml:1:4575: unexpected character `�`  12:27:15.025  DONE  Build complete. Watching for changes...  12:27:15.026 项目 'fish_diagnosis' 编译成功.  12:27:15.058 正在同步手机端程序文件...  12:27:15.463 同步手机端程序文件完成  12:27:15.488 正在重启,如手机上HBuilder调试基座未启动,请手动启动...  12:27:15.968 TypeError: $gwx is not a function  12:27:15.993 at file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/apps/HBuilder/www/app-view.js:115:27 at uniapp://ready:182  12:27:16.017 webviewScriptError  12:27:16.041 $gwx is not a function  12:27:16.064 TypeError: $gwx is not a function  12:27:16.092 at file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/apps/HBuilder/www/app-view.js:115:27 at uniapp://ready:182  12:27:16.113 Uncaught TypeError: $gwx is not a function at app-view.js:115

问题点是 unexpected character ,几番搜之后 最后发现是页面有几处字符 '< '导致的编译出错。。删掉后就通过编译可以运行到手机了

其它有可能就是中文变量导致的错误

参考回答: