34 lines
550 B
Vue
34 lines
550 B
Vue
|
<script>
|
||
|
export default {
|
||
|
expose: ["publicProperty", "publicMethod"],
|
||
|
props: {
|
||
|
posts: {
|
||
|
type: Array,
|
||
|
required: true,
|
||
|
},
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
publicProperty: null,
|
||
|
};
|
||
|
},
|
||
|
methods: {
|
||
|
publicMethod() {
|
||
|
// do something
|
||
|
},
|
||
|
},
|
||
|
};
|
||
|
</script>
|
||
|
|
||
|
<template>
|
||
|
<li
|
||
|
class=""
|
||
|
style="margin-bottom: 2em; border-bottom: 1px solid #eee"
|
||
|
v-for="(post, key) in posts"
|
||
|
:key="key"
|
||
|
>
|
||
|
<h4 style="margin-bottom: 0">{{ post.title }}</h4>
|
||
|
<p class="">{{ post.body }}</p>
|
||
|
</li>
|
||
|
</template>
|