From 5b306e2d5831824658e2e8ab2d5a995a60df4e99 Mon Sep 17 00:00:00 2001 From: vinney cavallo Date: Wed, 9 Aug 2023 12:45:07 -0400 Subject: [PATCH] add Post.vue example using data attributes for props --- _frontend/entrypoints/application.js | 8 ++++++++ _frontend/src/Post.vue | 22 ++++++++++++++++++++++ _layouts/default.html | 1 - _layouts/post.html | 2 ++ index.md | 1 + 5 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 _frontend/src/Post.vue diff --git a/_frontend/entrypoints/application.js b/_frontend/entrypoints/application.js index 5253e086..ba70f450 100644 --- a/_frontend/entrypoints/application.js +++ b/_frontend/entrypoints/application.js @@ -11,5 +11,13 @@ import '~/src/assets/index.scss' import { createApp } from 'vue' import App from '~/src/App.vue' +import Post from '~/src/Post.vue' createApp(App).mount('#app') + +const postElement = document.querySelector('#post') +const title = postElement.dataset.title +const post = createApp(Post, { + title +}); +post.mount('#post') diff --git a/_frontend/src/Post.vue b/_frontend/src/Post.vue new file mode 100644 index 00000000..9079bd6e --- /dev/null +++ b/_frontend/src/Post.vue @@ -0,0 +1,22 @@ + + + diff --git a/_layouts/default.html b/_layouts/default.html index f697f716..61f7d78a 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -9,6 +9,5 @@ {% include navigation.html %} {{ content }} -
diff --git a/_layouts/post.html b/_layouts/post.html index 370d9ebb..6666ce9b 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -15,3 +15,5 @@

{{ page.title }}

{{ content }} + +
diff --git a/index.md b/index.md index c25def3e..bc1cd139 100644 --- a/index.md +++ b/index.md @@ -7,6 +7,7 @@ title: Home ---

Test Hello

+ **this is bold in markdown**