Problems encountered in the project and solutions

start error

1. No matching version found for @babel/types@^7.10.1 error

    解决:cnpm install

2.Module build faild(from ./mode_modules/sass-loader/dist/cjs.js): TypeError: this.getOptions is not a function

解决:sass-loader版本太高,卸载后下载低版本

3.sock.js

/node_modules/sockjs-client/dist/sockjs.js 

解决:注释掉:self.xhr.send(payload);

const utf8Encoder = new TextEncoder(); ^ReferenceError: TextEncoder is not defined

引入mangoose报错
解决:node版本太低,切换高版本的node

other problems

1. Returning to the page after jumping to an external link does not refresh

    解决:浏览器问题(谷歌不刷新且没有缓存,手机浏览器部分会刷新,部分会直接展示缓存,与手机的版本以及浏览器的设置有关),改变思路,换了个方案:打开新的窗口(window.open)

2. Vant adds new components to indicate that there are no components in the es package

    解决:卸载重新安装

3. The git clone project reported an error: OpenSSL SSL_read: Connection was reset, errno 10054

    解决:命令行输入 git config --global http.sslVerify "false"

4. When el-upload uploads a file, if the previous file is still being uploaded, the unuploaded file will be overwritten when it is uploaded again.

    之前在调用success方法时,直接将返回结果res加入attachments里

    解决:改为在success里遍历fileList,通过判断response的值将fileList遍历塞给attachments.
success(res, file, fileList) {
    
    
      console.log(res, file, fileList);
      if (res.code == SUBMIT_NO) {
    
    
        this.$message.error(res.message);
        return;
      } else if (res.code == 401) {
    
    
         //登录超时
      }
      this.attachments.splice(0, this.attachments.length);
      // 附件中是否有上传中状态
      const upLoading = fileList.findIndex(item => {
    
    
        return item.status !== 'success';
      });
	  fileList.forEach(item => {
    
    
		if (item.response) {
    
    
		    this.attachments.push(item.response);
		} else {
    
    
		    this.attachments.push(item);
		}
	});
}

5. Vue multi-selection form Cannot read property '_selectionChanged' of undefined"

    解决:表格添加属性:lazy: true

6. CORS cross domain request error

    解决:html里添加<meta http-equiv="Access-Control-Allow-Origin" content="*" />

7. el-dialog + messagebox superimposes multiple bullet boxes resulting in multiple mask layers. When the outermost bullet box is closed, the mask layer is displayed on the outermost layer

    解决:之前的dialog使用的是 :modal-append-to-body="false" 改为 append-to-body

8. The el-form form verification is triggered when entering the page

解决:1.将表单的触发方式由change改为blur,这种方式会导致选择器组件无法及时更新错误提示
	  2.在mounted里执行clearValitdate(),清除表单校验。
	  this.$nextTick(() => {
	      this.$refs['form'].clearValidate();
	    });

9. border-image and border-radius are not compatible, border-radius invalid

解决:将border-image替换为background-image,内部再套一个div,设置border-radius,内容放在这个div里面。

10. The el-form form in vue3 cannot be entered

解决:el-form中model与ref同名了,改掉即可

11. el-upload uploads avatar error TypeError: xhr.upload.addEventListener is not a function

原因: mockjs拦截了XHR
解决:在node_modules中找到mockjs/dist/mockjs 8308行 mockjs/src/mock/xhr/xhr.js 216行 下添加这段代码 MockXMLHttpRequest.prototype.upload = xhr.upload;然后重启项目

11. toFixed rounding problem (normal in IE, rounding in Chrome)

原因:不同浏览器的原生方法不一致
解决:引入mathjs包,使用mathjs.format(value, precision)

12. watch $route invalid

原因:路由跳转是会销毁当前父组件的,对于新的组件来说,初始化的$route是不会判断其变化的
解决:加上immediate: true, 即立即执行

13. IOS time conversion failed: new Date(“2022-08-04 5:00:00”) returns invalid Date

原因:IOS只能解析“/”分割的日期
解决:new Date("2022-08-04 5:00:00".replace(/-/g, '/'))

14. Amount calculation accuracy loss problem

解决:借助big.js/decimal.js解决

15. element-ui loads internationalization on demand

解决:
按需加载:babel.config.js中添加[
  'component',
  {
    libraryName: 'element-ui',
    styleLibraryName: 'theme-chalk'
  }
]
创建element-ui.js手动导入所有需要用的组件
main.js中添加
import '@/plugins/element-ui';
//国际化
import eleLocale from 'element-ui/lib/locale';
eleLocale.i18n((key, value) => i18n.t(key, value));

16. The data obtained by getBoundingClientRect() is all 0

原因:在使用该函数获取元素在文档中的位置信息时,需保证元素已经在DOM上渲染才能使用
解决:在nextTick中调用

17. Browser warning: [DOM]Password field is not contained in a form

原因:Make sure that each authentication process (registration, login or change password) is grouped together in a single <form> element. Don’t combine multiple processes (like registration and login), or skip the <form> element.
解决:密码输入框套在<form>标签内

Guess you like

Origin blog.csdn.net/qq_41028148/article/details/123229117