一:h5多個(gè)網(wǎng)絡(luò)請(qǐng)求 ?控制loading結(jié)果之類Promise.all([promist1, promist2])的
let promist1 = new Promise((resolve, reject) => {
????????this.axios.post("/mobile/news/list", "1211").then(
??????????res => {
????????????this.sharr = res.body.data;
????????????resolve(res.body.data);
??????????},
??????????err => {
????????????reject('1')
??????????}
????????);
??????});
??????let promist2 = new Promise((resolve, reject) => {
????????this.axios.post("/mobile/news/list", "1211").then(
??????????res => {
????????????this.sharr = res.body.data;
????????????resolve(res.body.data);
??????????},
??????????err => {
????????????reject('2')
??????????}
????????);
??????});
??????Promise.all([promist1, promist2])
????????.then(result => {
??????????console.log(result); //[]
????????})
????????.catch(error => {
??????????console.log(error);
????????});
二:ios scroller刷新不能調(diào)用事件的問(wèn)題解決辦法
將\node_modules\_vux-xscroll@3.1.12@vux-xscroll\build\cmd\simulate-scroll.js下的getScrollTop方法里面的正則表達(dá)式替換成下面(/[-\d\.*\d*e\-\d]+/g )的就可以了浓体。
??????getScrollTop: function() {
????????// var transY = window.getComputedStyle(this.container)[transform].match(/[-\d\.*\d*]+/g);
????????var transY = window.getComputedStyle(this.container)[transform].match(/[-\d\.*\d*e\-\d]+/g);
????????return transY ? Math.round(transY[5]) === 0 ? 0 : -Math.round(transY[5]) : 0;
??????},
三:判斷is iosORandriod
isAndroid_ios() {
??????const u = navigator.userAgent;
??????const app = navigator.appVersion;
const isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; // android終端或者uc瀏覽器
// const isiOS = !!u.match(/\(i[^;]+;(?U;)??CPU.+Mac?OS?X/); // ios終端
??????return isAndroid;
},
四:打包后兩行超出解決辦法
webpack.prod.conf文件下 添加 autoprefixer: false 如下:
????new OptimizeCSSPlugin({
??????cssProcessorOptions: config.build.productionSourceMap
????????? { safe: true,autoprefixer: false, map: { inline: false } }
????????: { safe: true,autoprefixer: false }
????}),
css:
??????overflow: hidden;
??????text-overflow: ellipsis;
??????display: -webkit-box;
??????-webkit-line-clamp: 2;
??????/*! autoprefixer: off */
??????-webkit-box-orient: vertical !important;
??????/* autoprefixer: on */
五:aes加密用法
npm install crypto-js --save-dev
import {Encrypt,Decrypt} from "../../utils/Utils.js";
console.log("zzzzzzzzzzzzzz");
// Encrypt加密
????var a = Encrypt("test")
console.log("加密后:"+a);
//base64加解密