Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit fc0315a

Browse files
committed
feat: add print button to the right corner
1 parent 109fc76 commit fc0315a

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

assets/css/main.scss

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,31 @@ ul.icons a {
8989
}
9090

9191

92+
.corner-ribbon{
93+
width: 200px;
94+
background: #e43;
95+
position: absolute;
96+
top: 25px;
97+
left: -50px;
98+
text-align: center;
99+
line-height: 50px;
100+
letter-spacing: 1px;
101+
color: #f0f0f0;
102+
transform: rotate(-45deg);
103+
-webkit-transform: rotate(-45deg);
104+
}
105+
106+
.corner-ribbon.top-right{
107+
top: 25px;
108+
right: -50px;
109+
left: auto;
110+
transform: rotate(45deg);
111+
-webkit-transform: rotate(45deg);
112+
background: #1e8ad6
113+
}
114+
115+
.corner-ribbon.sticky{
116+
position: fixed;
117+
}
118+
119+

pages/index.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
<Education />
1010
<Hobbies />
1111
</el-main>
12+
<div class="corner-ribbon top-right sticky no-print" @click="print()">
13+
Print me
14+
</div>
1215
</el-container>
1316
<!-- @sproogen thanks for inspiration -->
1417
</template>
@@ -40,6 +43,9 @@ export default {
4043
type: "warning",
4144
customClass: "no-print"
4245
})
46+
},
47+
print: function() {
48+
window.print()
4349
}
4450
}
4551
}

0 commit comments

Comments
 (0)