AI销管
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 484 B

2 years ago
12345678910111213141516171819
  1. // 暂时不用vuex模块方式实现,将该方法直接放入到/store/index.js中
  2. const module = {
  3. actions: {
  4. $uStore({rootState}, params) {
  5. let nameArr = params.name.split('.');
  6. if(nameArr.length >= 2) {
  7. let obj = rootState[nameArr[0]];
  8. for(let i = 1; i < nameArr.length - 1; i ++) {
  9. obj = obj[nameArr[i]];
  10. }
  11. obj[nameArr[nameArr.length - 1]] = params.value;
  12. } else {
  13. rootState[params.name] = params.value;
  14. }
  15. }
  16. }
  17. }
  18. export default module