File tree 3 files changed +45
-0
lines changed
3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 32
32
4 . [ vue bus🔥] ( vue/README4.md )
33
33
5 . [ vue 使用jsx🔥] ( vue/README5.md )
34
34
6 . [ vue项目优化指南🔥] ( vue/README6.md )
35
+ 7 . [ vue 实现跳转新窗口 打开图片🔥] ( vue/README7.md )
35
36
36
37
37
38
Original file line number Diff line number Diff line change 61
61
62
62
```
63
63
64
+ ### 队列: Queue
65
+ > 在计算机科学中,一个队列(queue)是一种特殊类型的抽象数据类型或集合。集合中的实体按顺序保存。在前端开发中,最著名的队列使用当属浏览器/NodeJs中 关于宏任务与微任务,任务队列. 遵循"Fist In,first out"即:FIFO,先进先出。
66
+
67
+ ```
68
+ class Queue {
69
+ constructor(...items) {
70
+ this.reverse = false
71
+ this.queue = [...items]
72
+ }
73
+
74
+ enqueue(...items) {
75
+ return this.reverse
76
+ ? this.queue.push(...items)
77
+ : this.queue.unshift(...items)
78
+ }
79
+
80
+ dequeue() {
81
+ return this.reverse ? this.queue.shift() : this.queue.pop()
82
+ }
83
+ }
84
+
85
+
86
+ ```
87
+
88
+
64
89
65
90
66
91
Original file line number Diff line number Diff line change
1
+ ## Vue 实现跳转新窗口 打开图片(水文)
2
+
3
+ > 在页面添加一个a标签,隐藏起来,设置好target属性为_blank,href设为空,然后点击时,设置href的值
4
+
5
+
6
+ ```
7
+ <!-- template -->
8
+ <button @click="handleClick">打开新窗口</button>
9
+ <a ref="target" href="" target="_blank"></a>
10
+ <!-- template -->
11
+
12
+ <!-- js -->
13
+ handleClick() {
14
+ const target = this.$refs.target
15
+ target.setAttribute('href', 'http://pic.58pic.com/58pic/15/68/59/71X58PICNjx_1024.jpg')
16
+ target.click()
17
+ }
18
+
19
+ ```
You can’t perform that action at this time.
0 commit comments