This repository has been archived by the owner on Sep 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
TabCreate.vue
90 lines (82 loc) · 1.67 KB
/
TabCreate.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<template>
<app-content>
<title-bar :back-button="true">
<title-bar-text>
Create new tab
</title-bar-text>
</title-bar>
<app-tabs>
<form
slot="Custom"
:class="$style.tabContent"
@submit.prevent="createTab"
>
<app-form-input
v-model="tab.label"
required
label="Name"
descr="The tab label displayed in the sidebar."
/>
<app-form-input
v-model="tab.url"
type="url"
required
label="URL"
descr="Homepage of the tab. For example: https://google.com"
/>
<div :class="$style.actions">
<app-button
primary
type="submit"
>
Create
</app-button>
</div>
</form>
<suggested-apps
slot="By Template"
:class="$style.tabContent"
go-to-created-tab
/>
</app-tabs>
</app-content>
</template>
<script>
import SuggestedApps from '@/components/SuggestedApps.vue';
import TitleBar from '@/components/TitleBar.vue';
import TitleBarText from '@/components/TitleBarText.vue';
export default {
components: {
SuggestedApps,
TitleBar,
TitleBarText,
},
data() {
return {
tab: {
label: '',
url: 'https://',
},
};
},
methods: {
async createTab() {
const tab = await this.$store.dispatch('Tabs/create', this.tab);
this.$router.push({
name: 'tabs',
params: {
id: tab.id,
},
});
},
},
};
</script>
<style lang="postcss" module>
.actions {
@apply pt-6;
}
.tabContent {
@apply mt-4;
}
</style>