美文网首页
Vue手机端开发问题解决

Vue手机端开发问题解决

作者: 红太羊_8225 | 来源:发表于2020-11-10 09:01 被阅读0次

一:h5多个网络请求  控制loading结果之类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刷新不能调用事件的问题解决办法

将\node_modules\_vux-xscroll@3.1.12@vux-xscroll\build\cmd\simulate-scroll.js下的getScrollTop方法里面的正则表达式替换成下面(/[-\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加解密

相关文章

网友评论

      本文标题:Vue手机端开发问题解决

      本文链接:https://www.haomeiwen.com/subject/wclovktx.html