工作笔记

2020-10-13  本文已影响0人  弓长晓

ios默认盒子模型为content-box;而安卓和谷歌是border-box。
解决方法:给input设置box-sizing:border-box;(或者content-box)

背景居中

background-repeat: no-repeat;
background-size: cover;
 -webkit-background-size: cover;
 -o-background-size: cover;
 background-position: center 0;

vuex 的使用
store-index.vue

 //状态数据
  state: {
    alldata: [],
  },
  mutations: {
    alldata(state, res) {
      state.alldata = res;
      console.log(state.alldata.data);
    },
  },
  actions: {
 // 全部数据
    alldata(context) {
      axios
        .post("controllers/mainpage_ajax.php", { action: "getCases" })
        .then(res => {
          context.commit("alldata", res);
        });
    },
}

在使用的页面进行

created() {
// 方法一
this.$store.dispatch("alldata");
}

//方法二
created() {
this.alldata();
}
methods: {
...mapActions(["alldata"]),
}
// 方法三

// 方法四

vuex刷新消失问题
在mian.js中使用

//刷新保存状态
if (sessionStorage.getItem("store")) {
  store.replaceState(
    Object.assign(
      {},
      store.state,
      JSON.parse(sessionStorage.getItem("store"))
    )
  );
  sessionStorage.removeItem("store")
}
//监听,在页面刷新时将vuex里的信息保存到sessionStorage里
window.addEventListener("beforeunload", () => {
  sessionStorage.setItem("store", JSON.stringify(store.state));
});

页面跳转 不记录地址位置,苹果下导航栏与ui图不一同

 this.$router.replace("customer_selector");
上一篇 下一篇

猜你喜欢

热点阅读