diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 3119929..5fc13e3 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -82,6 +82,18 @@ export default defineConfig({ // text: 'How should my components communicate?', // link: '/faq/component-communication' // }, + // { + // text: 'How do I call a method in a child component?', + // link: '/faq/invoking-child-methods' + // }, + // { + // text: 'Why are my template refs not working?', + // link: '/faq/template-refs' + // }, + // { + // text: 'How can I share state with a composable?', + // link: '/faq/sharing-state' + // }, { text: 'How can I pass slots through to a child component?', link: '/faq/forwarding-slots' @@ -99,18 +111,22 @@ export default defineConfig({ link: '/faq/template-local-variables' }, // { - // text: 'Why does selecting one item select them all?', - // link: '/faq/independent-selections' + // text: 'Can I use JavaScript classes for my reactive data?', + // link: '/faq/reactivity-and-classes' // }, // { - // text: 'Why are my template refs not working?', - // link: '/faq/template-refs' + // text: 'Why does selecting one item select them all?', + // link: '/faq/independent-selections' // }, { text: 'How do I create unique element ids with Vue?', link: '/faq/unique-element-ids' }, // { + // text: `Why can't I use the current route inside App.vue?`, + // link: '/faq/accessing-the-route' + // }, + // { // text: `Why does my logging show an empty/missing value after I've loaded the data?`, // link: '/faq/logging-after-loading' // }, diff --git a/docs/faq/accessing-the-route.md b/docs/faq/accessing-the-route.md new file mode 100644 index 0000000..8096b67 --- /dev/null +++ b/docs/faq/accessing-the-route.md @@ -0,0 +1,7 @@ +# Why can't I use the current route inside `App.vue`? + +::: warning This answer is a stub. +We are still working on writing the answers to the FAQ questions. The answer below is incomplete, but you may still find it useful. +::: + +The short answer is *timing*. You can use the current route inside `App.vue`, but it won't be available in time for the initial render. diff --git a/docs/faq/index.md b/docs/faq/index.md index f788a00..36512a8 100644 --- a/docs/faq/index.md +++ b/docs/faq/index.md @@ -5,7 +5,7 @@ This FAQ aims to answer some of the most common programming questions that we ge It is not a substitute for the official Vue documentation, available at . Those docs include an FAQ for Vue itself at . ::: warning Work in progress -We've only just started work on this FAQ and most of the answers will be incomplete. Some questions don't really have an answer yet, they're just placeholders. +Only about half the questions have complete answers. Those questions are listed in the sidebar on the left. The other questions are just stubs. ::: --- @@ -46,13 +46,17 @@ We've only just started work on this FAQ and most of the answers will be incompl - [How should my components communicate?](component-communication) +- [How do I call a method in a child component?](invoking-child-methods) +- [Why are my template refs not working?](template-refs) +- [How can I share state with a composable?](sharing-state) - [How can I pass all slots through to a child component?](forwarding-slots) - [How can I make Vue 'wait' for the data before rendering?](delaying-rendering) - [Why isn't `v-html` rendering my components?](components-in-v-html) - [Can I create a local variable in my template?](template-local-variables) +- [Can I use JavaScript classes for my reactive data?](reactivity-and-classes) - [Why does selecting one item select them all?](independent-selections) -- [Why are my template refs not working?](template-refs) - [How do I create unique element ids with Vue?](unique-element-ids) +- [Why can't I use the current route inside `App.vue`?](accessing-the-route) --- diff --git a/docs/faq/invoking-child-methods.md b/docs/faq/invoking-child-methods.md new file mode 100644 index 0000000..bf940c5 --- /dev/null +++ b/docs/faq/invoking-child-methods.md @@ -0,0 +1,13 @@ +# How do I call a method in a child component? + +::: warning This answer is a stub. +We are still working on writing the answers to the FAQ questions. The answer below is incomplete, but you may still find it useful. +::: + +You can invoke methods on child components using template refs. See . + +If the child component is using `