Newer
Older
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
<template>
<li class="definition" :id="'def' + body.id">
<ul>
<li :is="element_wrapper.template" :body="element_wrapper.element" v-for="element_wrapper in template_name_added">{{element_wrapper.element}}</li>
</ul>
</li>
</template>
<script>
import DefElement from './DefElement.vue'
import Example from './Example.vue'
var Definition = {
name: 'Definition',
props: {
body: Object
},
components: {
DefElement,
Definition,
Example
},
computed: {
template_name_added: function(){
return this.body.elements.map(
function(element){
return {
'template': {
'explanation': 'DefElement',
'definition': 'Definition',
'example': 'Example'
}[element.type] || 'li',
'element': element
}
})
}
}
}
export default Definition
</script>
<style>
li.quote {
font-style: italic;
}
</style>