Skip to content

Commit 41bd155

Browse files
author
Jeffrey Biles
committed
Put marked call in the template so it's automatically reactive
1 parent 169c397 commit 41bd155

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/components/MailView.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<h2 class="mb-0">Subject: <strong>{{email.subject}}</strong></h2>
1111
<div><em>From {{email.from}} on {{format(new Date(email.sentAt), 'MMM do yyyy')}}</em></div>
12-
<div v-html="emailMarkdown" />
12+
<div v-html="marked(email.body)" />
1313
</div>
1414
</template>
1515

@@ -19,7 +19,7 @@
1919
import { format } from 'date-fns';
2020
2121
export default {
22-
setup({email}, {emit}) {
22+
setup({}, {emit}) {
2323
let goNewer = () => emit('changeEmail', {amount: -1})
2424
let goOlder = () => emit('changeEmail', {amount: 1})
2525
let goNewerAndArchive = () => emit('changeEmail', {amount: -1, toggleArchive: true})
@@ -35,14 +35,13 @@
3535
{key: 'e', fn: toggleArchive}
3636
])
3737
38-
let emailMarkdown = marked(email.body);
3938
return {
40-
emailMarkdown,
4139
toggleArchive,
4240
goNewer,
4341
goOlder,
4442
toggleRead,
45-
format
43+
format,
44+
marked,
4645
}
4746
},
4847
props: {

0 commit comments

Comments
 (0)