Move Vue into the vuejs directory

This commit is contained in:
Oliver Davies 2019-06-05 19:23:45 +01:00
parent a4b018204d
commit d7c864b63b
21 changed files with 13 additions and 15 deletions

78
vuejs/src/App.vue Normal file
View file

@ -0,0 +1,78 @@
<template>
<div id="app" class="antialiased min-h-screen font-sans bg-gray-100 text-black p-12">
<div class="w-full max-w-2xl mx-auto">
<accepted-sessions-list :sessions="sortedSessions" />
<session-form @submitted="addSession($event)"></session-form>
</div>
</div>
</template>
<script>
import _ from 'lodash'
import AcceptedSessionsList from '@/components/AcceptedSessionsList'
import SessionForm from '@/components/SessionForm'
const axios = require('axios')
export default {
components: {
AcceptedSessionsList,
SessionForm
},
data () {
return {
loaded: false,
sessions: []
}
},
mounted () {
const baseUrl = process.env.VUE_APP_DRUPAL_URL
axios.get(`${baseUrl}/jsonapi/node/session`)
.then(({ data }) => {
this.loaded = true
this.sessions = data.data
})
},
methods: {
addSession: function (session) {
this.sessions.push(session)
}
},
computed: {
sortedSessions: function () {
return _(this.sessions).sortBy(({ attributes }) => attributes.title)
}
}
}
</script>
<style>
@tailwind base;
h1,
h2 {
@apply font-semibold
}
input,
textarea {
@apply w-full border border-gray-400 p-2 mt-1
}
input[type=submit] {
@apply w-full;
@screen sm {
@apply w-auto
}
}
@tailwind components;
@tailwind utilities;
</style>