commit | author | age
|
32b599
|
1 |
<template> |
CM |
2 |
<div> |
|
3 |
<active-element |
|
4 |
:topic-title="activeTopic && activeTopic.title" |
|
5 |
:text="activeTopic && activeTopic.fullText" |
|
6 |
></active-element> |
1dc4e4
|
7 |
<knowledge-base @select-topic="activateTopic"></knowledge-base> |
32b599
|
8 |
</div> |
CM |
9 |
</template> |
|
10 |
|
|
11 |
<script> |
|
12 |
export default { |
|
13 |
data() { |
|
14 |
return { |
|
15 |
topics: [ |
|
16 |
{ |
|
17 |
id: 'basics', |
|
18 |
title: 'The Basics', |
|
19 |
description: 'Core Vue basics you have to know', |
|
20 |
fullText: |
|
21 |
'Vue is a great framework and it has a couple of key concepts: Data binding, events, components and reactivity - that should tell you something!', |
|
22 |
}, |
|
23 |
{ |
|
24 |
id: 'components', |
|
25 |
title: 'Components', |
|
26 |
description: |
|
27 |
'Components are a core concept for building Vue UIs and apps', |
|
28 |
fullText: |
|
29 |
'With components, you can split logic (and markup) into separate building blocks and then combine those building blocks (and re-use them) to build powerful user interfaces.', |
|
30 |
}, |
|
31 |
], |
|
32 |
activeTopic: null, |
|
33 |
}; |
|
34 |
}, |
1dc4e4
|
35 |
provide:{ |
CM |
36 |
topics: [ |
|
37 |
{ |
|
38 |
id: 'basics', |
|
39 |
title: 'The Basics', |
|
40 |
description: 'Core Vue basics you have to know', |
|
41 |
fullText: |
|
42 |
'Vue is a great framework and it has a couple of key concepts: Data binding, events, components and reactivity - that should tell you something!', |
|
43 |
}, |
|
44 |
{ |
|
45 |
id: 'components', |
|
46 |
title: 'Components', |
|
47 |
description: |
|
48 |
'Components are a core concept for building Vue UIs and apps', |
|
49 |
fullText: |
|
50 |
'With components, you can split logic (and markup) into separate building blocks and then combine those building blocks (and re-use them) to build powerful user interfaces.', |
|
51 |
}, |
|
52 |
], |
|
53 |
}, |
32b599
|
54 |
methods: { |
CM |
55 |
activateTopic(topicId) { |
|
56 |
this.activeTopic = this.topics.find((topic) => topic.id === topicId); |
|
57 |
}, |
|
58 |
}, |
|
59 |
}; |
|
60 |
</script> |
|
61 |
|
|
62 |
<style> |
|
63 |
* { |
|
64 |
box-sizing: border-box; |
|
65 |
} |
|
66 |
html { |
|
67 |
font-family: sans-serif; |
|
68 |
} |
|
69 |
body { |
|
70 |
margin: 0; |
|
71 |
} |
|
72 |
section { |
|
73 |
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.26); |
|
74 |
margin: 2rem auto; |
|
75 |
max-width: 40rem; |
|
76 |
padding: 1rem; |
|
77 |
border-radius: 12px; |
|
78 |
} |
|
79 |
|
|
80 |
ul { |
|
81 |
list-style: none; |
|
82 |
margin: 0; |
|
83 |
padding: 0; |
|
84 |
display: flex; |
|
85 |
justify-content: center; |
|
86 |
} |
|
87 |
|
|
88 |
li { |
|
89 |
border-radius: 12px; |
|
90 |
border: 1px solid #ccc; |
|
91 |
padding: 1rem; |
|
92 |
width: 15rem; |
|
93 |
margin: 0 1rem; |
|
94 |
display: flex; |
|
95 |
flex-direction: column; |
|
96 |
justify-content: space-between; |
|
97 |
} |
|
98 |
|
|
99 |
h2 { |
|
100 |
margin: 0.75rem 0; |
|
101 |
text-align: center; |
|
102 |
} |
|
103 |
|
|
104 |
button { |
|
105 |
font: inherit; |
|
106 |
border: 1px solid #c70053; |
|
107 |
background-color: #c70053; |
|
108 |
color: white; |
|
109 |
padding: 0.75rem 2rem; |
|
110 |
border-radius: 30px; |
|
111 |
cursor: pointer; |
|
112 |
} |
|
113 |
|
|
114 |
button:hover, |
|
115 |
button:active { |
|
116 |
background-color: #e24d8b; |
|
117 |
border-color: #e24d8b; |
|
118 |
} |
|
119 |
</style> |