选项卡右键优化
Showing
1 changed file
with
15 additions
and
16 deletions
... | @@ -10,10 +10,10 @@ | ... | @@ -10,10 +10,10 @@ |
10 | </router-link> | 10 | </router-link> |
11 | </scroll-pane> | 11 | </scroll-pane> |
12 | <ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu"> | 12 | <ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu"> |
13 | <li @click="refreshSelectedTag(selectedTag)">Refresh</li> | 13 | <li @click="refreshSelectedTag(selectedTag)">刷新</li> |
14 | <li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">Close</li> | 14 | <li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">关闭</li> |
15 | <li @click="closeOthersTags">Close Others</li> | 15 | <li @click="closeOthersTags">关闭其他</li> |
16 | <li @click="closeAllTags(selectedTag)">Close All</li> | 16 | <li @click="closeAllTags(selectedTag)">关闭所有</li> |
17 | </ul> | 17 | </ul> |
18 | </div> | 18 | </div> |
19 | </template> | 19 | </template> |
... | @@ -164,18 +164,17 @@ export default { | ... | @@ -164,18 +164,17 @@ export default { |
164 | } | 164 | } |
165 | }, | 165 | }, |
166 | openMenu (tag, e) { | 166 | openMenu (tag, e) { |
167 | const menuMinWidth = 105 | 167 | // const menuMinWidth = 105 |
168 | const offsetLeft = this.$el.getBoundingClientRect().left // container margin left | 168 | // const offsetLeft = this.$el.getBoundingClientRect().left // container margin left |
169 | const offsetWidth = this.$el.offsetWidth // container width | 169 | // const offsetWidth = this.$el.offsetWidth // container width |
170 | const maxLeft = offsetWidth - menuMinWidth // left boundary | 170 | // const maxLeft = offsetWidth - menuMinWidth // left boundary |
171 | const left = e.clientX - offsetLeft + 15 // 15: margin right | 171 | // const left = e.clientX - offsetLeft + 15 // 15: margin right |
172 | 172 | // if (left > maxLeft) { | |
173 | if (left > maxLeft) { | 173 | // this.left = maxLeft |
174 | this.left = maxLeft | 174 | // } else { |
175 | } else { | 175 | // this.left = left |
176 | this.left = left | 176 | // } |
177 | } | 177 | this.left = e.clientX |
178 | |||
179 | this.top = e.clientY | 178 | this.top = e.clientY |
180 | this.visible = true | 179 | this.visible = true |
181 | this.selectedTag = tag | 180 | this.selectedTag = tag | ... | ... |
-
Please register or sign in to post a comment