-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvuetify-stepper.html
More file actions
141 lines (133 loc) · 4.68 KB
/
vuetify-stepper.html
File metadata and controls
141 lines (133 loc) · 4.68 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href='https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons' rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/vuetify/dist/vuetify.min.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify/dist/vuetify.js"></script>
<script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vuex/3.0.1/vuex.js"></script>
<title>Vuetify</title>
</head>
<body>
<div id="app">
<v-app id="inspire">
<v-content>
<v-stepper v-model="stepper">
<v-stepper-header>
<div class="step" v-for="(step, index) in steps" :key=index>
<v-stepper-step :edit-icon="'check'" :complete-icon="'edit'" :step="index + 1" :complete="(index + 1 ) <= stepper"
:editable="(index + 1) < stepper">{{ step.label }}</v-stepper-step>
<v-divider></v-divider>
</div>
</v-stepper-header>
<v-stepper-items>
<v-stepper-content step="1">
<v-card color="grey lighten-1" class="mb-5" height="200px"></v-card>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn flat @click="goBack">Back</v-btn>
<v-btn color="primary" @click="goForward">Continue</v-btn>
</v-card-actions>
</v-stepper-content>
<v-stepper-content step="2">
<v-card color="grey lighten-1" class="mb-5" height="200px"></v-card>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn flat @click="goBack">Back</v-btn>
<v-btn color="primary" @click="goForward">Continue</v-btn>
</v-card-actions>
</v-stepper-content>
<v-stepper-content step="3">
<v-card color="grey lighten-1" class="mb-5" height="200px"></v-card>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn flat @click="goBack">Back</v-btn>
<v-btn color="primary" @click="goForward">Continue</v-btn>
</v-card-actions>
</v-stepper-content>
</v-stepper-items>
</v-stepper>
</v-content>
</v-app>
</div>
<script>
const store = new Vuex.Store({
state: {
stepper: 1
},
mutations: {
setStepper (state, val) {
state.stepper = val
}
}
})
let routerAfter = {
after: (from, to) => {
console.log("from")
console.dir(from)
// console.log("to")
// console.dir(to)
let step = from.query.step || 1
store.commit('setStepper', step)
}
}
const router = new window.VueRouter({
})
router.afterEach(routerAfter.after)
new Vue({
el: '#app',
router,
store,
data: () => ({
curStep: 1,
steps: [{
label: 'Basic Info',
completed: false,
}, {
label: 'Login Details',
completed: false,
}, {
label: 'Create Project',
completed: false,
}, ],
}),
computed: {
stepper: function() {
return this.$store.state.stepper
}
},
methods: {
goBack: function() {
this.curStep--;
if (this.curStep < 0) this.curStep = 3
// this.stepper = this.curStep
this.$router.push({path: '', query: {step:this.curStep}})
this.$store.commit('setStepper', this.curStep)
},
goForward: function() {
this.curStep++;
if (this.curStep >= 4) this.curStep = 1
// this.stepper = this.curStep
// let url = window.location.protocol + "//" + window.location
// console.log("url")
// console.log(url)
this.$store.commit('setStepper', this.curStep)
this.$router.push({path: '', query: {step:this.curStep}
// (location) => {
// debugger
// this.stepper = location.query.step
})
},
mounted: function() {
debugger
this.$router.push({path: '', query: {step:this.curStep}})
}
}
})
</script>
</body>
</html>