Skip to content

Commit 26523ae

Browse files
author
BeauTheBeau
committed
Update button click behavior
Refined the behavior of website and repo opening in new cards along with the report issue action. A click now opens in the same tab, while an auxiliary click (middle click or CTRL+click) opens the link in a new tab.
1 parent d6859df commit 26523ae

2 files changed

Lines changed: 15 additions & 12 deletions

File tree

src/App.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
<v-toolbar app>
55
<v-toolbar-title>Construct Fund</v-toolbar-title>
66
<v-spacer></v-spacer>
7-
<v-btn text @click="reportIssue()">
7+
<v-btn text @click="reportIssue('_self')" @auxclick="reportIssue('_blank')">
88
<v-icon right>mdi-open-in-new</v-icon>
99
Report issue
1010
</v-btn>
1111
</v-toolbar>
1212
<div class="parent">
13-
<Card v-for="(item, i) in content" key="i" :content="item" />
13+
<Card v-for="(item) in content" key="i" :content="item"/>
1414
</div>
1515
</v-main>
1616
</v-app>
@@ -20,10 +20,10 @@
2020
import Card from "@/components/Card.vue";
2121
import content from "@/assets/content.json";
2222
23-
function reportIssue() {
23+
function reportIssue(target) {
2424
window.open(
25-
"https://github.com/ConstructFund/constructfund.github.io/issues/"
26-
);
25+
"https://github.com/ConstructFund/constructfund.github.io/issues/",
26+
target);
2727
}
2828
</script>
2929

src/components/Card.vue

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
<h2 class="title">{{ content.name }}</h2>
99
<v-spacer></v-spacer>
1010
<div v-if="content.hasWebsite">
11-
<v-btn @click="openWebsite" variant="text"> Open Website </v-btn>
11+
<v-btn
12+
@click="openWebsite('_self')"
13+
@auxclick="openWebsite('_blank')"
14+
variant="text"> Open Website </v-btn>
1215
<v-icon right>mdi-open-in-new</v-icon>
1316
</div>
1417
</v-toolbar>
@@ -30,7 +33,7 @@
3033
</v-sheet>
3134

3235
<v-sheet v-if="content.hasWebsite" width="100%" class="button">
33-
<v-btn @click="openWebsite" variant="text" style="width: 100%">
36+
<v-btn @click="openWebsite('_self')" @auxclick="openWebsite('_blank')" variant="text" style="width: 100%">
3437
Open Website
3538
</v-btn>
3639
</v-sheet>
@@ -46,7 +49,7 @@
4649
</v-chip>
4750
</div>
4851
<div style="display: flex; flex-wrap: nowrap" v-if="content.hasRepo">
49-
<v-btn @click="openRepo">Open Repo</v-btn>
52+
<v-btn @click="openRepo('_self')" @auxclick="openRepo('_blank')">Open Repo</v-btn>
5053
<v-icon>mdi-github</v-icon>
5154
</div>
5255
</v-card-actions>
@@ -74,12 +77,12 @@ const chipColor = computed(() => {
7477
7578
const isMobile = useMediaQuery("(max-width: 700px)");
7679
77-
function openWebsite() {
78-
window.open(props.content.url);
80+
function openWebsite(target) {
81+
window.open(props.content.url, target);
7982
}
8083
81-
function openRepo() {
82-
window.open(props.content.repo);
84+
function openRepo(target) {
85+
window.open(props.content.repo, target);
8386
}
8487
</script>
8588

0 commit comments

Comments
 (0)