坑一:mpvue开发小程序时候,要添加静态本地图片
报错:
VM14878:2 Failed to load local image resource /images/bg.png
the server responded with a status of 404 (HTTP/1.1 404 Not Found)
*解决方法:将放图片的文件夹放在static文件夹里,static是专门用来放静态文件的
坑二:data中每个键值对,:后面要有空格;
报错:
✘ http://eslint.org/docs/rules/key-spacing Missing space before value for key ‘tabs’
srcpagestestindex.vue:22:12
坑三:字符串必须以单引号包括;
报错:
✘ http://eslint.org/docs/rules/quotes Strings must use singlequote
srcpagestestindex.vue:23:9
坑三:定义函数时,(括号)前(后)都要有空格
报错:
✘ http://eslint.org/docs/rules/space-before-function-paren Missing space before function parentheses
srcpagestestindex.vue:31:23
坑四:函数中各语句间不用加分号
坑五:button按钮获取用户信息,weui里好像不对;
直接为button添加点击事件,设置其open-type和lang,在函数回调里即可获得用户信息
代码如下:
版权声明
本文仅代表作者观点,不代表百度立场。
本文系作者授权百度百家发表,未经许可,不得转载。



