Skip to content

Commit 1c90d9d

Browse files
committed
Added additional routes.
1 parent 2126bc3 commit 1c90d9d

File tree

6 files changed

+141
-8
lines changed

6 files changed

+141
-8
lines changed

public/_redirects

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* /index.html 200
File renamed without changes.

src/main.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
import Vue from 'vue/dist/vue.js'
2-
import App from './App.vue'
32
import VueRouter from 'vue-router'
43

4+
import Example from './views/Example.vue'
5+
import DesignList from './views/DesignList.vue'
6+
import DesignEdit from './views/DesignEdit.vue'
7+
58
Vue.config.productionTip = false
69

710
const routes = [
8-
{ path: '/', component: App },
11+
{ path: '/', component: Example },
12+
{ path: '/dashboard', component: DesignList },
13+
{ path: '/dashboard/new', component: DesignEdit },
14+
{ path: '/dashboard/edit/:designId', component: DesignEdit },
915
]
1016

1117
const router = new VueRouter({
18+
mode: 'history',
1219
routes
1320
})
1421

src/views/DesignEdit.vue

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<template>
2+
<div id="designEdit">
3+
<div class="container">
4+
<div id="bar">
5+
<h1>Vue Email Editor (Demo)</h1>
6+
7+
<router-link to="/dashboard">Dashboard</router-link>
8+
<button v-on:click="saveDesign">Save Design</button>
9+
<button v-on:click="exportHtml">Export HTML</button>
10+
</div>
11+
12+
<EmailEditor ref="editor" v-on:load="editorLoaded" />
13+
</div>
14+
</div>
15+
</template>
16+
17+
<script>
18+
import { EmailEditor } from '../components'
19+
20+
export default {
21+
name: 'designEdit',
22+
components: {
23+
EmailEditor
24+
},
25+
methods: {
26+
editorLoaded() {
27+
},
28+
saveDesign() {
29+
this.$refs.editor.saveDesign(
30+
(design) => {
31+
console.log('saveDesign', design);
32+
}
33+
)
34+
},
35+
exportHtml() {
36+
this.$refs.editor.exportHtml(
37+
(data) => {
38+
console.log('exportHtml', data);
39+
}
40+
)
41+
}
42+
}
43+
}
44+
</script>
45+
46+
<style>
47+
html, body {
48+
margin: 0;
49+
padding: 0;
50+
height: 100%;
51+
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
52+
}
53+
54+
#app, #designEdit {
55+
height: 100%;
56+
}
57+
58+
#designEdit .container {
59+
display: flex;
60+
flex-direction: column;
61+
position: relative;
62+
height: 100%;
63+
}
64+
65+
#bar {
66+
flex: 1;
67+
background-color: #40B883;
68+
color: #FFF;
69+
padding: 10px;
70+
display: flex;
71+
max-height: 40px;
72+
}
73+
74+
#bar h1 {
75+
flex: 1;
76+
font-size: 16px;
77+
text-align: left;
78+
}
79+
80+
#bar button {
81+
flex: 1;
82+
padding: 10px;
83+
margin-left: 10px;
84+
font-size: 14px;
85+
font-weight: bold;
86+
background-color: #000;
87+
color: #FFF;
88+
border: 0px;
89+
max-width: 150px;
90+
cursor: pointer;
91+
}
92+
93+
#bar a {
94+
flex: 1;
95+
padding: 10px;
96+
margin-left: 10px;
97+
font-size: 14px;
98+
font-weight: bold;
99+
color: #fff;
100+
border: 0px;
101+
cursor: pointer;
102+
text-align: right;
103+
text-decoration: none;
104+
line-height: 160%;
105+
}
106+
</style>

src/views/DesignList.vue

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<div id="designList">
3+
<h1>My Designs</h1>
4+
5+
<p>
6+
<router-link to="/dashboard/new">New Design</router-link>
7+
</p>
8+
</div>
9+
</template>
10+
11+
<script>
12+
export default {
13+
name: 'designList',
14+
components: {
15+
},
16+
methods: {
17+
}
18+
}
19+
</script>

src/App.vue renamed to src/views/Example.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div id="app">
2+
<div id="example">
33
<div class="container">
44
<div id="bar">
55
<h1>Vue Email Editor (Demo)</h1>
@@ -14,11 +14,11 @@
1414
</template>
1515

1616
<script>
17-
import { EmailEditor } from './components'
18-
import sample from './sample.json';
17+
import { EmailEditor } from '../components'
18+
import sample from '../data/sample.json';
1919
2020
export default {
21-
name: 'app',
21+
name: 'example',
2222
components: {
2323
EmailEditor
2424
},
@@ -52,11 +52,11 @@ html, body {
5252
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
5353
}
5454
55-
#app {
55+
#app, #example {
5656
height: 100%;
5757
}
5858
59-
#app .container {
59+
#example .container {
6060
display: flex;
6161
flex-direction: column;
6262
position: relative;

0 commit comments

Comments
 (0)