This should also work in the Vue composition API
May 6, 2024
9
Level 14
Passing props to component in composition api
I've built an app using the options api and now I'm learning the composition api, mainly because I need to reuse half the code elsewhere
I could pass props to a component inside the #app div using the options api like so:
import CalendarYear from "./CalendarYear.vue";
export default {
components: { CalendarYear }
}
<div id="app">
<calendar-year
route="{{ route('api.calendars.base-calendars.show', $calendar) }}"
route-save="{{ route('api.calendars.base-calendars.edit', $calendar) }}"
></calendar-year>
</div>
Is there a way to do the same in the comp api?
Level 29
@JackJones Try to use this in app.js
import './bootstrap';
import { createApp } from "vue/dist/vue.esm-bundler";
import CalendarxYear from './components/CalendarxYear.vue'
const app = createApp()
app.component('calendar-year', CalendarxYear)
app.mount('#app')
Please or to participate in this conversation.