added content from /gdp/corpus
This commit is contained in:
@@ -0,0 +1,44 @@
|
|||||||
|
<template>
|
||||||
|
<article class="corpus item">
|
||||||
|
<header>
|
||||||
|
<h1>
|
||||||
|
<a
|
||||||
|
:href="item.url"
|
||||||
|
@click.prevent="onclick"
|
||||||
|
@keyup.enter="onclick"
|
||||||
|
v-html="item.title"
|
||||||
|
/>
|
||||||
|
</h1>
|
||||||
|
</header>
|
||||||
|
<div class="text-quantity" v-html="item.textsQuantity"/>
|
||||||
|
</article>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'CorpusItems',
|
||||||
|
props: {
|
||||||
|
item: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: () => ({
|
||||||
|
|
||||||
|
}),
|
||||||
|
methods: {
|
||||||
|
onclick () {
|
||||||
|
console.log('clicked on corpus item', this.item)
|
||||||
|
// this.$router.push({
|
||||||
|
// name:`article`,
|
||||||
|
// params: { alias:this.alias },
|
||||||
|
// query: { uuid: this.item.uuid }
|
||||||
|
// // meta: { uuid:this.item.uuid },
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
</style>
|
||||||
+27
-22
@@ -5,38 +5,43 @@
|
|||||||
>
|
>
|
||||||
<h1>Corpus</h1>
|
<h1>Corpus</h1>
|
||||||
<span v-if="!items.length">Loading ...</span>
|
<span v-if="!items.length">Loading ...</span>
|
||||||
|
<div v-else class="item-list">
|
||||||
|
<ul>
|
||||||
|
<li v-for="item in items" v-bind:key="item.url">
|
||||||
|
<CorpusItem :item="item" />
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { REST } from 'api/rest-axios'
|
import CorpusItem from '../components/Content/CorpusItem'
|
||||||
|
import { mapState, mapActions } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Corpus',
|
name: 'Corpus',
|
||||||
|
components: {
|
||||||
|
CorpusItem
|
||||||
|
},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
items: []
|
// items: []
|
||||||
}),
|
}),
|
||||||
beforeCreate () {
|
computed: {
|
||||||
// items/gdpLeMaire1685T01BodyFr01.003.016
|
...mapState({
|
||||||
// texts/gdpSauval1724
|
items: state => state.Corpus.items
|
||||||
REST.get(`/corpus`, {})
|
})
|
||||||
.then(({ data }) => {
|
},
|
||||||
console.log('corpus REST: data', data)
|
created () {
|
||||||
// if(data.length){
|
if (!this.items.length) {
|
||||||
// commit('setItems',data)
|
this.getItems()
|
||||||
// // console.log('items.length', this.items.length);
|
}
|
||||||
// if(state.infiniteLoadingState)
|
},
|
||||||
// state.infiniteLoadingState.loaded()
|
methods: {
|
||||||
// }else{
|
...mapActions({
|
||||||
// if(state.infiniteLoadingState)
|
getItems: 'Corpus/getItems'
|
||||||
// state.infiniteLoadingState.complete()
|
})
|
||||||
// }
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.warn('Issue with corpus', error)
|
|
||||||
Promise.reject(error)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
+2
-1
@@ -1,11 +1,12 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
|
|
||||||
// https://github.com/vuejs/vuex/tree/dev/examples/shopping-cart
|
import Corpus from './modules/corpus'
|
||||||
|
|
||||||
Vue.use(Vuex)
|
Vue.use(Vuex)
|
||||||
export default new Vuex.Store({
|
export default new Vuex.Store({
|
||||||
modules: {
|
modules: {
|
||||||
|
Corpus
|
||||||
// search
|
// search
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import { REST } from 'api/rest-axios'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
namespaced: true,
|
||||||
|
|
||||||
|
// initial state
|
||||||
|
state: {
|
||||||
|
items: []
|
||||||
|
},
|
||||||
|
|
||||||
|
// getters
|
||||||
|
getters: {},
|
||||||
|
|
||||||
|
// mutations
|
||||||
|
mutations: {
|
||||||
|
setItems (state, content) {
|
||||||
|
state.items = state.items.concat(content)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// actions
|
||||||
|
actions: {
|
||||||
|
getItems ({ dispatch, commit, state }) {
|
||||||
|
return REST.get(`/corpus`, {})
|
||||||
|
.then(({ data }) => {
|
||||||
|
console.log('corpus REST: data', data)
|
||||||
|
commit('setItems', data.content)
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.warn('Issue with corpus', error)
|
||||||
|
Promise.reject(error)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user