lw-cdp-ui 1.2.3 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +1,23 @@
1
1
  <template>
2
2
  <div class="adminui-tags">
3
- <ul ref="tags">
4
- <draggable v-model="$store.state.viewTags.viewTags"
5
- @change="changeTages"
6
- itemKey="name">
7
- <template #item="{element: tag, index}" keyName="tag">
8
- <li v-bind:key="tag"
9
- :class="[isActive(tag)?'active':'',tag.meta.affix?'affix':'' ]"
10
- @contextmenu.prevent="openContextMenu($event, tag)">
11
- <router-link :to="tag">
12
- <span>{{ getIdName(tag) }}</span>
13
- <el-icon v-if="!tag.meta.affix"
14
- @click.prevent.stop='closeSelectedTag(tag)'><el-icon-close /></el-icon>
15
- </router-link>
16
- </li>
17
- </template>
18
- </draggable>
19
-
20
- </ul>
3
+ <draggable v-model="$store.state.viewTags.viewTags"
4
+ @change="changeTages"
5
+ class="context-menu-list"
6
+ ref="tags"
7
+ itemKey="name">
8
+ <template #item="{element: tag, index}"
9
+ keyName="tag">
10
+ <li v-bind:key="tag"
11
+ :class="[isActive(tag)?'active':'',tag.meta.affix?'affix':'' ]"
12
+ @contextmenu.prevent="openContextMenu($event, tag)">
13
+ <router-link :to="tag">
14
+ <span>{{ getIdName(tag) }}</span>
15
+ <el-icon v-if="!tag.meta.affix"
16
+ @click.prevent.stop='closeSelectedTag(tag)'><el-icon-close /></el-icon>
17
+ </router-link>
18
+ </li>
19
+ </template>
20
+ </draggable>
21
21
  </div>
22
22
 
23
23
  <transition name="el-zoom-in-top">
@@ -90,19 +90,6 @@ export default {
90
90
  },
91
91
  $route(e) {
92
92
  this.addViewTags(e);
93
- //判断标签容器是否出现滚动条
94
- this.$nextTick(() => {
95
- const tags = this.$refs.tags
96
- if (tags && tags.scrollWidth > tags.clientWidth) {
97
- //确保当前标签在可视范围内
98
- let targetTag = tags.querySelector(".active")
99
- targetTag.scrollIntoView()
100
- //显示提示
101
- if (!this.tipDisplayed) {
102
- this.tipVisible = true
103
- }
104
- }
105
- })
106
93
  },
107
94
  contextMenuVisible(value) {
108
95
  var _this = this;
@@ -157,7 +144,7 @@ export default {
157
144
  return null
158
145
  },
159
146
  // 拖动排序
160
- changeTages (val) {
147
+ changeTages(val) {
161
148
  this.$tool.data.set('RouteTags', this.$store.state.viewTags.viewTags)
162
149
  },
163
150
  //增加tag
@@ -169,6 +156,20 @@ export default {
169
156
  this.$store.commit("pushKeepLive", route.name)
170
157
  this.$tool.data.set('RouteTags', this.$store.state.viewTags.viewTags)
171
158
  }
159
+
160
+ //判断标签容器是否出现滚动条
161
+ this.$nextTick(() => {
162
+ const tags = document.querySelector(".context-menu-list")
163
+ if (tags && tags.scrollWidth > tags.clientWidth) {
164
+ //确保当前标签在可视范围内
165
+ let targetTag = tags.querySelector(".active")
166
+ targetTag.scrollIntoView()
167
+ //显示提示
168
+ if (!this.tipDisplayed) {
169
+ this.tipVisible = true
170
+ }
171
+ }
172
+ })
172
173
  },
173
174
  //高亮tag
174
175
  isActive(route) {
@@ -289,7 +290,7 @@ export default {
289
290
  },
290
291
  //横向滚动
291
292
  scrollInit() {
292
- const scrollDiv = this.$refs.tags;
293
+ const scrollDiv = document.querySelector('.context-menu-list')
293
294
  scrollDiv.addEventListener('mousewheel', handler, false) || scrollDiv.addEventListener("DOMMouseScroll", handler, false)
294
295
  function handler(event) {
295
296
  const detail = event.wheelDelta || event.detail;
@@ -383,8 +384,4 @@ export default {
383
384
  .tags-tip p {
384
385
  margin-bottom: 10px;
385
386
  }
386
-
387
- .dark .contextmenu li {
388
- color: var(--el-text-color-primary);
389
- }
390
387
  </style>