eg: this.commonLoginFun().then((res) => { if (res.errNo === 0) { const { isLogin } = res.data; if (isLogin) { this.isLogin = true; this.userPhone = res.data.phone; } else { this.isLogin = false; } } }); 在commonLoginFun中: methods:{ commonLoginFun(){ r…
https://www.jianshu.com/p/b980725b62e8 https://www.npmjs.com/package/vue-wechat-title 详细信息查看:vue-weachat-title 解决问题: 1.Vuejs 单页应用在iOS系统下部分APP的webview中 标题不能通过 document.title = xxx 的方式修改 该插件只为解决该问题而生(兼容安卓) 2.在vue单页面中,通过浏览器分享到QQ.微信等应用中的链接,只有一个首页标题和默认ico…
http://www.cnblogs.com/Wenwang/archive/2012/01/06/2314283.html http://www.cnblogs.com/yangjunhua/archive/2012/04/12/2444106.html 下面的参考:http://evantre.iteye.com/blog/1718777 1.选题缘起 在知乎上瞎逛的时候看到一个自问自答的问题: 知乎上,前端开发领域有哪些值得推荐的问答?,然后在有哪些经典的 Web 前端或者 JavaScr…
Promise的使用相比大家已经孰能生巧了,我这里就不赘述了 先说说我写的Promise的问题吧,无法实现宏任务和微任务里的正确执行(也就是在Promise里面写setTimeout,setInterval的话,输出顺序会有问题),其他的API(catch.finally.race.all)有兴趣的话,大家可以斟酌补充. 开始贴代码: // 定义一个Promise类function Promise(fn){ // 回调队列 存放的所有的.then里面的回调 this.callbacks = []…
1.cnpm安装 cnpm i babel-polyfill --save cnpm i es6-promise --save 2.main.js引入 import ‘babel-polyfill‘ import Es6Promise from ‘es6-promise‘ Es6Promise.polyfill() 3.webpack.base.conf.js module.exports = { entry: { "babel-polyfill":"babel-polyfi…
var that = this;that.hello().then(res => { return that.world(res);}).then(res => { console.log(res); }) function hello(){ var that = this; var p = new Promise((resolve,reject) => { resolve('hello '); }) return p; } function world(params){ var tha…
关于处理移动端Vue单页面及其内嵌兼容问题 question:由于最近转移了以前的H5项目,重构使用Vue单页面,导致部分手机内嵌或在微信浏览器中无法浏览,或者无法使用ajax请求:手机机型千变万化,系统版本也各种各样,通宵优化上线后成功处理问题 ,也只是兼容大部分主流手机,虽然解决方案并不是很突出,但是查找问题的路太痛苦了 首先需要解决低版本系统的移动端无法渲染页面,因为低版本浏览器只支持ES5语法,而我在写单页面时基本都使用了ES6语法,所以首先需要全局把ES6语法转换为ES5语法 这里引用…
vue-meta-info 官方地址: monkeyWangs/vue-meta-info (设置vue 单页面meta info信息,如果需要单页面SEO,可以和 prerender-spa-plugin形成更优的配合) 单页面应用在前端正大放光彩.三大框架 Angular.Vue.React,可谓妇孺皆知.随着单页面应用的普及,人们在感受其带来的完美的用户体验,极强的开发效率的同时,也似乎不可避免的要去处理 SEO 的需求. 本文主要针对 vue 2.0 单页面 Meta SEO 优化展开介…
部署各vue项目,走了一遍坑.... vue单页面应用刷新404 找到nginx多网站配置文件:类似nginx/sites-available/www.baidu.com server { listen ; index index.html index.htm index.nginx-debian.html; server_name www.baidu.com; location / { root /mnt/www/www.baidu.com; try_files $uri $uri/ /ind…
由于在vue单页应用中title只设定在入口文件index.html,如果切换路由,title怎么更换? 在路由router中设置meta: { path:'/chooseBrand', component: resolve => require(['../components/page/myzone.vue'], resolve), meta: { title: 'title标题' } 在main.js里面加上 router.beforeEach((to, from, next) => {…