Skip to content

Commit b2a0d79

Browse files
committed
✨ Add vue 实现跳转新窗口 打开图片
1 parent 7c6bc8a commit b2a0d79

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
4. [vue bus🔥](vue/README4.md)
3333
5. [vue 使用jsx🔥](vue/README5.md)
3434
6. [vue项目优化指南🔥](vue/README6.md)
35+
7. [vue 实现跳转新窗口 打开图片🔥](vue/README7.md)
3536

3637

3738

dataStructure/README1.md

+25
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,31 @@
6161
6262
```
6363

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+
6489

6590

6691

vue/README7.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
```

0 commit comments

Comments
 (0)