Browse Source

init

newStyle
lancer 2 years ago
parent
commit
a5b3567eb2
4 changed files with 20 additions and 0 deletions
  1. +2
    -0
      src/page/index/tags.vue
  2. +1
    -0
      src/store/modules/tags.js
  3. +7
    -0
      src/util/util.js
  4. +10
    -0
      src/views/Receive/index.vue

+ 2
- 0
src/page/index/tags.vue View File

@@ -123,6 +123,8 @@
if(value=='/wel/index'){return}
if (action === 'remove') {
let { tag, key } = this.findTag(value)
// console.log(tag,'关闭的标签');
// return
this.$store.commit('DEL_TAG', tag)
if (tag.value === this.tag.value) {
tag = this.tagList[key === 0 ? key : key - 1] // 如果关闭本标签让前推一个


+ 1
- 0
src/store/modules/tags.js View File

@@ -47,6 +47,7 @@ const navs = {
state.tagList = state.tagList.filter(item => {
return !diff(item, action)
})
// console.log(state,action,'内容');
setFistTag(state.tagList)
setStore({ name: 'tagList', content: state.tagList, type: 'session' })
},


+ 7
- 0
src/util/util.js View File

@@ -62,10 +62,13 @@ export const diff = (obj1, obj2) => {
var o1 = obj1 instanceof Object
var o2 = obj2 instanceof Object
if (!o1 || !o2) { /* 判断不是对象 */
// console.log(1);
return obj1 === obj2
}

if (Object.keys(obj1).length !== Object.keys(obj2).length) {
// console.log(2);
console.log(Object.keys(obj1).length,Object.keys(obj2).length);
return false
// Object.keys() 返回一个由对象的自身可枚举属性(key值)组成的数组,例如:数组返回下表:let arr = ["a", "b", "c"];console.log(Object.keys(arr))->0,1,2;
}
@@ -74,11 +77,15 @@ export const diff = (obj1, obj2) => {
var t1 = obj1[attr] instanceof Object
var t2 = obj2[attr] instanceof Object
if (t1 && t2) {
// console.log(3);
return diff(obj1[attr], obj2[attr])
} else if (obj1[attr] !== obj2[attr]) {
// console.log(obj1[attr],obj2[attr]);
// console.log(4);
return false
}
}
// console.log(5);
return true
}
/**


+ 10
- 0
src/views/Receive/index.vue View File

@@ -723,6 +723,16 @@ export default {
},
methods: {
gojianyi(){
// console.log(this.$route);
let tag={
group:[],
label: "接待详情",
params:{},
query:this.$route.query,
value:this.$route.fullPath,
}
// console.log(tag);
this.$store.commit('DEL_TAG', tag)
this.$router.go(-1);//返回上一层
},
//上一首


Loading…
Cancel
Save