简体   繁体   English

尝试将 Vue 组件集成到我的 React 应用程序中

[英]Trying to integrate a Vue component into my React App

Attempting to call a Vue component into my React application, and have run into many errors.尝试将 Vue 组件调用到我的 React 应用程序中,但遇到了许多错误。 I've tried to use 'VueWrapper' from 'vuera , and I've tried to point the imported .vue app right into the filepath, but nothing is making sense.我尝试使用'VueWrapper' from 'vuera ,并尝试将导入的.vue应用程序指向文件路径,但没有任何意义。

I eventually tried placing the .Vue file into the src files of my React app (I know it must be dumb, but I'm new to both React and Vue, and have no idea what I'm doing.)我最终尝试将.Vue文件放入我的 React 应用程序的src文件中(我知道它一定.Vue ,但我对 React 和 Vue 都是新手,不知道我在做什么。)

The Error : Module not found: Can't resolve 'vue' in 'C:\\Users\\me\\WebstormProjects\\navtaskv2\\node_modules\\vuera\\dist'错误: Module not found: Can't resolve 'vue' in 'C:\\Users\\me\\WebstormProjects\\navtaskv2\\node_modules\\vuera\\dist'

Here is the plugin js file I'm trying to pull the Vue app into:这是我试图将 Vue 应用程序拉入的插件js文件:

import navtaskv from "./VueApp.vue";
import { VueWrapper } from 'vuera'
import React from "react";


export default () => (
    <div>
        <VueWrapper
            component={navtaskv}
            message='Hello from Vue!'
        />
    </div>
)

Not sure if I need to have anything imported on the Vue component's side, but I'm assuming not.不确定是否需要在 Vue 组件一侧导入任何内容,但我假设不需要。 Please be easy on me, I'm truly lost!请放过我,我真的迷路了! ): ):

Looks like you haven't installed vue yet.看起来你还没有安装vue

Try running npm install vue and you should be good to go.尝试运行npm install vue ,你应该很高兴。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM