forked from lin-xin/notepad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.vue
169 lines (165 loc) · 4.96 KB
/
App.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<template>
<div id="app" :class="[getTheme]">
<n-header @tools="changePages"></n-header>
<section class="container" :class="{'hide': table}">
<n-add></n-add>
<n-list></n-list>
<n-sidebar :is-show="tools"
@cleardialog="clearData"
@uploadData="uploadData"
@opentable="table = true;tools = false"
@opentheme="theme = true;tools = false"
></n-sidebar>
</section >
<transition name="dialog">
<!-- <n-dialog :is-show="dialog" :msg="tips" @cancel="dialog = false" @sure="sureDialog"></n-dialog> -->
<n-dialog v-show="dialog" :msg="tips" @cancel="dialog = false" @sure="sureDialog"></n-dialog>
</transition>
<n-table @deldialog="delData" :is-show="table" @close="table = false"></n-table>
<n-theme :is-show="theme" @close="theme = false"></n-theme>
<n-footer></n-footer>
</div>
</template>
<script>
import nHeader from './components/header.vue';
import nFooter from './components/footer.vue';
import nAdd from './components/event_add.vue';
import nTable from './components/event_table.vue';
import nList from './components/event_list.vue';
import nSidebar from './components/sidebar.vue';
import nDialog from './components/dialog.vue';
import nTheme from './components/theme.vue';
export default {
data(){
return {
tools: false,
dialog: false,
table: false,
theme: false,
dialog_type: '',
tips: '',
del_info: {
index: 0,
id: 0
}
}
},
components: {
nHeader, nAdd, nSidebar, nDialog, nTable, nList, nTheme, nFooter
},
computed:{
getTheme(){ // 获取主题色
return this.$store.getters.getTheme;
}
},
methods: {
clearData(){
this.tools = false;
this.dialog = true;
this.dialog_type = 'clear';
this.tips = '清空后无法恢复,确认清空吗?';
},
delData(index,id){
this.dialog = true;
this.dialog_type = 'del';
this.tips = '删除后无法恢复,确认删除吗?';
this.del_info = {
index: index,
id : id
}
},
uploadData(){
this.tools = false;
this.dialog = true;
this.dialog_type = 'upload';
this.tips = 'upload';
},
sureDialog(){
const self = this;
switch (self.dialog_type){
case 'clear':
self.$store.dispatch('clearevent');
self.$toast('清空数据成功');
break;
case 'del':
self.$store.dispatch('delevent',self.del_info);
self.$toast('删除成功');
break;
}
this.dialog = false;
},
changePages(){
if(this.table){
this.table = !this.table;
}else if(this.theme){
this.theme = !this.theme;
}else{
this.tools = !this.tools
}
}
}
}
</script>
<style lang="scss" rel="stylesheet/scss" src="../static/theme.scss"></style>
<style lang="scss" rel="stylesheet/scss">
html,body,ul,li,input,p{
margin:0;
padding:0;
}
body{
font-size: 16px;
font-family: "Helvetica Neue", Helvetica, "microsoft yahei", arial, STHeiTi, sans-serif;
}
input,button{
-webkit-tap-highlight-color: transparent;
}
input[type=text]{
-webkit-appearance: none;
}
button{
padding:7px 0;
outline: none;
text-align: center;
border-radius: 4px;
box-sizing: border-box;
font:{
size:inherit;
family: inherit;
}
cursor: pointer;
}
html,body{
height: 100%;
}
::-webkit-scrollbar{
width: 0;
}
body,#app{
width:100%;
overflow-x: hidden;
}
#app{
height: 100%;
padding-bottom: 60px;
box-sizing: border-box;
}
ul{
list-style: none;
}
.container{
width:100%;
padding: 0 10px;
max-width:800px;
margin:auto;
box-sizing: border-box;
&.hide{
display: none;
}
}
.dialog-enter-active, .dialog-leave-active {
transition: opacity .3s;
}
.dialog-enter, .dialog-leave-to{
opacity: 0;
}
</style>