style:table样式
Showing
4 changed files
with
2 additions
and
90 deletions
src/components/lb-table/index.js
deleted
100644 → 0
... | @@ -96,6 +96,7 @@ export default { | ... | @@ -96,6 +96,7 @@ export default { |
96 | created () { | 96 | created () { |
97 | this.getMergeArr(this.data, this.merge) | 97 | this.getMergeArr(this.data, this.merge) |
98 | this.getHeight() | 98 | this.getHeight() |
99 | console.log(66666666666666); | ||
99 | }, | 100 | }, |
100 | computed: { | 101 | computed: { |
101 | dataLength () { | 102 | dataLength () { | ... | ... |
1 | <template> | 1 | <template> |
2 | <section class="app-main"> | 2 | <section class="app-main"> |
3 | <transition name="fade-transform" mode="out-in"> | 3 | <transition name="fade-transform" mode="out-in"> |
4 | <keep-alive :include="cachedViews"> | 4 | <router-view /> |
5 | <router-view :key="key" /> | ||
6 | </keep-alive> | ||
7 | </transition> | 5 | </transition> |
8 | </section> | 6 | </section> |
9 | </template> | 7 | </template> |
... | @@ -11,9 +9,6 @@ | ... | @@ -11,9 +9,6 @@ |
11 | export default { | 9 | export default { |
12 | name: 'AppMain', | 10 | name: 'AppMain', |
13 | computed: { | 11 | computed: { |
14 | cachedViews () { | ||
15 | return this.$store.state.tagsView.cachedViews | ||
16 | }, | ||
17 | key () { | 12 | key () { |
18 | return this.$route.path | 13 | return this.$route.path |
19 | }, | 14 | }, | ... | ... |
1 | const state = { | 1 | const state = { |
2 | visitedViews: [], | 2 | visitedViews: [], |
3 | cachedViews: ['leaseDetails'] | ||
4 | } | 3 | } |
5 | 4 | ||
6 | const mutations = { | 5 | const mutations = { |
... | @@ -12,13 +11,6 @@ const mutations = { | ... | @@ -12,13 +11,6 @@ const mutations = { |
12 | }) | 11 | }) |
13 | ) | 12 | ) |
14 | }, | 13 | }, |
15 | ADD_CACHED_VIEW: (state, view) => { | ||
16 | if (state.cachedViews.includes(view.name)) return | ||
17 | if (!view.meta.noCache) { | ||
18 | state.cachedViews.push(view.name) | ||
19 | } | ||
20 | }, | ||
21 | |||
22 | DEL_VISITED_VIEW: (state, view) => { | 14 | DEL_VISITED_VIEW: (state, view) => { |
23 | for (const [i, v] of state.visitedViews.entries()) { | 15 | for (const [i, v] of state.visitedViews.entries()) { |
24 | if (v.path === view.path) { | 16 | if (v.path === view.path) { |
... | @@ -27,35 +19,18 @@ const mutations = { | ... | @@ -27,35 +19,18 @@ const mutations = { |
27 | } | 19 | } |
28 | } | 20 | } |
29 | }, | 21 | }, |
30 | DEL_CACHED_VIEW: (state, view) => { | ||
31 | const index = state.cachedViews.indexOf(view.name) | ||
32 | index > -1 && state.cachedViews.splice(index, 1) | ||
33 | }, | ||
34 | 22 | ||
35 | DEL_OTHERS_VISITED_VIEWS: (state, view) => { | 23 | DEL_OTHERS_VISITED_VIEWS: (state, view) => { |
36 | state.visitedViews = state.visitedViews.filter(v => { | 24 | state.visitedViews = state.visitedViews.filter(v => { |
37 | return v.meta.affix || v.path === view.path | 25 | return v.meta.affix || v.path === view.path |
38 | }) | 26 | }) |
39 | }, | 27 | }, |
40 | DEL_OTHERS_CACHED_VIEWS: (state, view) => { | ||
41 | const index = state.cachedViews.indexOf(view.name) | ||
42 | if (index > -1) { | ||
43 | state.cachedViews = state.cachedViews.slice(index, index + 1) | ||
44 | } else { | ||
45 | // if index = -1, there is no cached tags | ||
46 | state.cachedViews = [] | ||
47 | } | ||
48 | }, | ||
49 | 28 | ||
50 | DEL_ALL_VISITED_VIEWS: state => { | 29 | DEL_ALL_VISITED_VIEWS: state => { |
51 | // keep affix tags | 30 | // keep affix tags |
52 | const affixTags = state.visitedViews.filter(tag => tag.meta.affix) | 31 | const affixTags = state.visitedViews.filter(tag => tag.meta.affix) |
53 | state.visitedViews = affixTags | 32 | state.visitedViews = affixTags |
54 | }, | 33 | }, |
55 | DEL_ALL_CACHED_VIEWS: state => { | ||
56 | state.cachedViews = [] | ||
57 | }, | ||
58 | |||
59 | UPDATE_VISITED_VIEW: (state, view) => { | 34 | UPDATE_VISITED_VIEW: (state, view) => { |
60 | for (let v of state.visitedViews) { | 35 | for (let v of state.visitedViews) { |
61 | if (v.path === view.path) { | 36 | if (v.path === view.path) { |
... | @@ -69,83 +44,30 @@ const mutations = { | ... | @@ -69,83 +44,30 @@ const mutations = { |
69 | const actions = { | 44 | const actions = { |
70 | addView ({ dispatch }, view) { | 45 | addView ({ dispatch }, view) { |
71 | dispatch('addVisitedView', view) | 46 | dispatch('addVisitedView', view) |
72 | dispatch('addCachedView', view) | ||
73 | }, | 47 | }, |
74 | addVisitedView ({ commit }, view) { | 48 | addVisitedView ({ commit }, view) { |
75 | commit('ADD_VISITED_VIEW', view) | 49 | commit('ADD_VISITED_VIEW', view) |
76 | }, | 50 | }, |
77 | addCachedView ({ commit }, view) { | ||
78 | commit('ADD_CACHED_VIEW', view) | ||
79 | }, | ||
80 | 51 | ||
81 | delView ({ dispatch, state }, view) { | ||
82 | return new Promise(resolve => { | ||
83 | dispatch('delVisitedView', view) | ||
84 | dispatch('delCachedView', view) | ||
85 | resolve({ | ||
86 | visitedViews: [...state.visitedViews], | ||
87 | cachedViews: [...state.cachedViews] | ||
88 | }) | ||
89 | }) | ||
90 | }, | ||
91 | delVisitedView ({ commit, state }, view) { | 52 | delVisitedView ({ commit, state }, view) { |
92 | return new Promise(resolve => { | 53 | return new Promise(resolve => { |
93 | commit('DEL_VISITED_VIEW', view) | 54 | commit('DEL_VISITED_VIEW', view) |
94 | resolve([...state.visitedViews]) | 55 | resolve([...state.visitedViews]) |
95 | }) | 56 | }) |
96 | }, | 57 | }, |
97 | delCachedView ({ commit, state }, view) { | ||
98 | return new Promise(resolve => { | ||
99 | commit('DEL_CACHED_VIEW', view) | ||
100 | resolve([...state.cachedViews]) | ||
101 | }) | ||
102 | }, | ||
103 | 58 | ||
104 | delOthersViews ({ dispatch, state }, view) { | ||
105 | return new Promise(resolve => { | ||
106 | dispatch('delOthersVisitedViews', view) | ||
107 | dispatch('delOthersCachedViews', view) | ||
108 | resolve({ | ||
109 | visitedViews: [...state.visitedViews], | ||
110 | cachedViews: [...state.cachedViews] | ||
111 | }) | ||
112 | }) | ||
113 | }, | ||
114 | delOthersVisitedViews ({ commit, state }, view) { | 59 | delOthersVisitedViews ({ commit, state }, view) { |
115 | return new Promise(resolve => { | 60 | return new Promise(resolve => { |
116 | commit('DEL_OTHERS_VISITED_VIEWS', view) | 61 | commit('DEL_OTHERS_VISITED_VIEWS', view) |
117 | resolve([...state.visitedViews]) | 62 | resolve([...state.visitedViews]) |
118 | }) | 63 | }) |
119 | }, | 64 | }, |
120 | delOthersCachedViews ({ commit, state }, view) { | ||
121 | return new Promise(resolve => { | ||
122 | commit('DEL_OTHERS_CACHED_VIEWS', view) | ||
123 | resolve([...state.cachedViews]) | ||
124 | }) | ||
125 | }, | ||
126 | |||
127 | delAllViews ({ dispatch, state }, view) { | ||
128 | return new Promise(resolve => { | ||
129 | dispatch('delAllVisitedViews', view) | ||
130 | dispatch('delAllCachedViews', view) | ||
131 | resolve({ | ||
132 | visitedViews: [...state.visitedViews], | ||
133 | cachedViews: [...state.cachedViews] | ||
134 | }) | ||
135 | }) | ||
136 | }, | ||
137 | delAllVisitedViews ({ commit, state }) { | 65 | delAllVisitedViews ({ commit, state }) { |
138 | return new Promise(resolve => { | 66 | return new Promise(resolve => { |
139 | commit('DEL_ALL_VISITED_VIEWS') | 67 | commit('DEL_ALL_VISITED_VIEWS') |
140 | resolve([...state.visitedViews]) | 68 | resolve([...state.visitedViews]) |
141 | }) | 69 | }) |
142 | }, | 70 | }, |
143 | delAllCachedViews ({ commit, state }) { | ||
144 | return new Promise(resolve => { | ||
145 | commit('DEL_ALL_CACHED_VIEWS') | ||
146 | resolve([...state.cachedViews]) | ||
147 | }) | ||
148 | }, | ||
149 | 71 | ||
150 | updateVisitedView ({ commit }, view) { | 72 | updateVisitedView ({ commit }, view) { |
151 | commit('UPDATE_VISITED_VIEW', view) | 73 | commit('UPDATE_VISITED_VIEW', view) | ... | ... |
-
Please register or sign in to post a comment