Vue.js 如何将inertiaJS与类星体框架集成?

Vue.js 如何将inertiaJS与类星体框架集成?,vue.js,quasar-framework,quasar,inertiajs,Vue.js,Quasar Framework,Quasar,Inertiajs,我想将intertiaJS集成到我的Quasar应用程序中,这样我就可以与我的Laravel后端进行通信。我现在的问题是,一般的东西被Quasar CLI接管,这在原则上是好的,但在这种情况下,它带走了我的入口点,如所述: 从“vue”导入{createApp,h} 从'@inertiajs/inertia-vue3'导入{App,plugin} const el=document.getElementById('app') createApp({ 渲染:()=>h(应用程序{ initialP

我想将intertiaJS集成到我的Quasar应用程序中,这样我就可以与我的Laravel后端进行通信。我现在的问题是,一般的东西被Quasar CLI接管,这在原则上是好的,但在这种情况下,它带走了我的入口点,如所述:

从“vue”导入{createApp,h}
从'@inertiajs/inertia-vue3'导入{App,plugin}
const el=document.getElementById('app')
createApp({
渲染:()=>h(应用程序{
initialPage:JSON.parse(el.dataset.page),
resolveComponent:name=>require(`./Pages/${name}`)。默认值,
})
}).使用(插件).安装(el)
我的想法是,我可以使用像Quasar()中提供的引导文件,但我必须承认我没有正确的方法。 当我查看自动生成的app.js时,我发现渲染过程中没有发生任何特殊情况:

/**
*此文件是自动生成的。
*不要编辑。
*
*您可能正在考虑添加启动/初始化代码。
*使用“quasar new boot”并将其添加到那里。
*每个问题一个启动文件。然后参考quasar.conf.js>boot中的文件:
*引导:['file',…]//不要向其添加“.js”扩展名。
*
*启动文件是您的“main.js”
**/
从“Vue”导入Vue
导入“./import quasar.js”
从“App/src/App.vue”导入应用程序
从“app/src/store/index”导入createStore
从“app/src/router/index”导入createRouter
导出默认异步函数(){
//创建存储和路由器实例
const store=typeof createStore==“函数”
?等待createStore({Vue})
:createStore
const router=typeof createRouter==‘函数’
?等待createRouter({Vue,store})
:createRouter
//使路由器实例在应用商店中可用
存储。$router=路由器
//创建应用程序实例化对象。
//这里我们注入路由器,存储到所有子组件,
//将它们作为“this.$router”和“this.$store”随处可用。
常量应用={
路由器,
商店,
渲染:h=>h(应用程序)
}
app.el=“#q-app”
//公开应用程序、路由器和商店。
//注意,我们没有在这里安装应用程序,因为引导将被禁用
//这取决于我们是在浏览器中还是在服务器上。
返回{
应用程序,
商店,
路由器
}
}
也就是说,原则上,我应该能够在不引起任何冲突的情况下进行链接。问题是,那会是什么样子

之后我必须链接到渲染中,并按照代码示例中所述覆盖它。我想继续使用Quasar Cli,因为它非常有用,这里描述的情况是唯一的例外


p7

引导文件是插入和初始化您自己的依赖项的正确位置,或者只是为您的应用程序配置一些启动代码

我还没有机会使用您提到的库,但我会详细介绍一下如何实现

创建启动文件

import { plugin } from '@inertiajs/inertia-vue'

export default async ({ app, Vue }) => {
    Vue.use(plugin)
}
在那之前你有50%。另一方面,您不能对主实例进行混入,但可以对每个页面进行混入,但是我建议您制作一个组件,向其中添加所需的数据,并对所需的库进行混入

<template>
    <div />
</template>

import { App } from '@inertiajs/inertia-vue'
<script>
export default {
    mixins: [App],
    props: ['initialPage', 'resolveComponent'],
}
</script>

从'@inertiajs/inertia vue'导入{App}
导出默认值{
mixins:[应用程序],
道具:['initialPage','resolveComponent'],
}
为此,请根据您使用的库的工作方式进行修改