- 博客(4)
- 收藏
- 关注
原创 Vuex使用之同步用户信息
//config/store.jsconst store = new Vuex.Store({state: {user: {}},mutations:{username(state, data){state.user = data;}}})//在组件中使用computed: {user() {return this.$store.state.user;}}```/...
2019-12-24 19:32:12
157
原创 VueX
{{name}} 我们引入 Vuex ,用它来管理状态数据,例如这里面的 name。首先在 src 中新建一个 store.js 文件,并写下如下熟悉的代码:import Vue from ‘vue’;import Vuex from ‘vuex’;Vue.use(Vuex);export default new Vuex.Store({st...
2019-12-24 19:02:16
70
原创 在浏览器地址栏按回车、F5、Ctrl+F5刷新网页的区别
不少同学问,不都是刷新吗?还有什么区别?其实,还是有的。其中,在地址栏按回车又分为两种情况。一是请求的URI在浏览器缓存中未过期,此时,使用Firefox的firebug插件在浏览器里显示的HTTP请求消息头如下:Host 192.168.3.174:8080User-Agent Mozilla/5.0 (Windows...
2019-12-12 16:05:44
337
原创 Vue路由守卫(全局路由守卫/局部路由守卫)
router.beforeEach((to,from,next)=>{//全局路由守卫 路由钩子函数let isLogin=localStorage.username;//声明变量isLogin,本地存获取到的用户名赋值给isLoginif(to.meta.requireAuth){//进行判断跳到哪个路径的值,如果为false的话不必进行路由守卫/则为true的话进行判断if(is...
2019-12-12 15:54:37
2302
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人