Skip to content

Commit

Permalink
add router for creating event
Browse files Browse the repository at this point in the history
  • Loading branch information
YiDaoJ committed Nov 9, 2022
1 parent e75e93d commit 2bf442e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<template>
<nav>
<router-link :to="{ name: 'EventList' }">Event</router-link> |
<router-link :to="{ name: 'AboutView' }">About</router-link>
<router-link :to="{ name: 'AboutView' }">About</router-link> |
<router-link :to="{ name: 'CreateEvent' }">Create Event</router-link>
</nav>
<router-view />
</template>
Expand Down
6 changes: 6 additions & 0 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import EventList from '@/views/EventList.vue'
import AboutView from '@/views/AboutView.vue'
import EventDetail from '@/views/EventDetail.vue'
import CreateEvent from '@/views/CreateEvent.vue'

const routes: Array<RouteRecordRaw> = [
{
Expand All @@ -14,6 +15,11 @@ const routes: Array<RouteRecordRaw> = [
name: 'AboutView',
component: AboutView,
},
{
path: '/create',
name: 'CreateEvent',
component: CreateEvent,
},
{
path: '/event/:id',
name: 'EventDetail',
Expand Down
39 changes: 39 additions & 0 deletions src/views/CreateEvent.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<template>
<div>create event forms</div>
<form>
<BaseInput v-model="event.title" label="Title" type="text" />
<BaseInput v-model="event.description" label="Descirption" type="text" />
<BaseInput v-model="event.location" label="Location" type="text" />
</form>
</template>

<script lang="ts">
import { iEvent } from '@/types'
import { defineComponent } from 'vue'
import BaseInput from '@/components/BaseInput.vue'
export default defineComponent({
components: {
BaseInput,
},
data() {
return {
categories: [
'sustainability',
'nature',
'animal welfare',
'housing',
'education',
'food',
'community',
],
event: {
category: '',
title: '',
description: '',
location: '',
} as Partial<iEvent>,
}
},
})
</script>

0 comments on commit 2bf442e

Please sign in to comment.