How to solve the compatibility problem in developing projects using VueJS
This article mainly introduces the relevant knowledge of "how to solve the compatibility problems in VueJS development projects". The editor shows you the operation process through actual cases. The operation method is simple, fast and practical. I hope this article "how to solve compatibility problems in VueJS development projects" can help you solve the problem.
1. Prompt "object does not support moveToElementText property or method" under KingEditor,IE
Solution:
The kingEditor I use is V4.1.10.
Modify the 5844 line of kingEditor.js:
If (_ IE) {var rng = cmd.range.get (true); rng.moveToElementText (div [0]); rng.select (); rng.execCommand ('paste'); e.preventDefault ();}
Modified to:
If (_ IE) {var rng = cmd.range.get (true); try {rng.moveToElementText (div [0]); rng.select (); rng.execCommand ('paste'); e.preventDefault ();} catch (e) {}}
Replace the kingEditor-min.js after compressing the kingEditor.js
Long string concatenation of 2.vue components
Long string concatenation is not compatible with ie, so string concatenation is required.
Post request for 3.axios.js.
Under chrome
Var newParams = new URLSearchParams (); newParams.append ('type',vm.typeNum); newParams.append (' num','20'); newParams.append ('curpage',vm.cur); axios.post (url,newParams). Then (function (res) {}) .catch (function () {})
Required under ie
Axios ({method: 'post', url:' / fhand apixis listCPN newsletter, data: {type: vm.typeNum, num: 4, curpage: vm.cur} TransformRequest: [function (data) {var ret =''for (var it in data) {ret + = encodeURIComponent (it) +' ='+ encodeURIComponent (data [it]) +'&'} return ret}] Headers: {'Content-Type':' application/x-www-form-urlencoded'}}) .then (function (response) {vm.articel_list = response.data.informations Vm.all = Math.ceil (response.data.totalnum/4);}, function (responese) {/ / console.log (responese);})
4. Under IE, prompt that "Promise" is not defined
Need to import polyfill.js file
This is the end of the introduction to "how to solve compatibility problems in VueJS development projects". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.