当前位置: 首页 > wzjs >正文

网站开发的相关岗位三亚百度推广公司

网站开发的相关岗位,三亚百度推广公司,wordpress建站创业,wap 企业网站网上的信息太少了,记录一下 我的项目是vue3webpack 使用:veaury Veaury 是基于React和Vue3的工具库,主要用于React和Vue在一个项目中公共使用的场景,主要运用在项目迁移、技术栈融合的开发模式、跨技术栈使用第三方组件的场景。 参…

网上的信息太少了,记录一下
我的项目是vue3+webpack
使用:veaury
Veaury 是基于React和Vue3的工具库,主要用于React和Vue在一个项目中公共使用的场景,主要运用在项目迁移、技术栈融合的开发模式、跨技术栈使用第三方组件的场景。
参考:
https://github.com/gloriasoft/veaury/tree/master/dev-project-vue3

建议:把这个项目拉下来运行,如果自己项目存在依赖报错,可以在这个项目上修改对比测试

如果是用vite直接看项目主页的配置:
https://github.com/gloriasoft/veaury/tree/master


前提: 安装
    "react": "^19.1.0","react-dom": "^19.1.0","veaury": "^2.6.2","babel-preset-react-app": "^10.1.0",

因为react版本高于19.0,在main.js中配置:

// react-dom >= 19
import { createRoot } from 'react-dom/client'
import { setVeauryOptions } from 'veaury'
setVeauryOptions({react: {createRoot}
})

写了一个测试用的TestComponent.jsx

import React from 'react'
console.log('React========>?', React)
const TestComponent = () => {return (<div style={{ padding: '20px', border: '1px solid #ccc', borderRadius: '5px' }}><h1>Hello from React!</h1><p>This is a test React component rendered inside a Vue app.</p></div>)
}export default TestComponent

在vue代码中使用:

<template><div><iconContent/></div>
</template>
<script>
import { applyPureReactInVue } from 'veaury'
import TestComponent from '@/views/ai/react/base/app-icon/TestComponent.jsx'
export default {components: {iconContent: applyPureReactInVue(TestComponent)},
}

运行报错:
Uncaught Error: Objects are not valid as a React child (found: object with keys {__v_isVNode, __v_skip, type, props, key, ref, scopeId, slotScopeIds, children, component, suspense, ssContent, ssFallback, dirs, transition, el, anchor, target, targetStart, targetAnchor, staticCount, shapeFlag, patchFlag, dynamicProps, dynamicChildren, appContext, ctx}). If you meant to render a collection of children, use an array instead.

*在这里插入图片描述*

我最开始把这段配置漏了
在这里插入图片描述

加上之后运行又报错:

‘loose’ mode configuration must be the same for @babel/plugin-transform-class-properties, @babel/plugin-transform-private-methods and @babel/plugin-transform-private-property-in-object (when they are enabled).
在这里插入图片描述
我的配置里用了
plugins: [
‘@babel/plugin-transform-private-methods’
]
@babel/plugin-transform-private-methods 插件,来处理依赖中类中的私有方法(以 # 开头的方法)。
如果你没有用,应该不会报错了


最终babel.config.js文件:

const path = require('path')
function resolve (dir) {return path.join(__dirname, dir)
}module.exports = {presets: ['@vue/cli-plugin-babel/preset',['veaury/babel/ReactPreset', {// for dev onlytest: function (filename) {// The files in the following paths are compiled with React's jsx// 我的react代码都放在react目录下if (filename?.startsWith(resolve('src')) && filename.match(/[/\\]react[\\/$]+/) || filename?.startsWith(resolve('../src'))) return filename}}]],plugins: [['@babel/plugin-transform-class-properties', { loose: true }],['@babel/plugin-transform-private-methods', { loose: true }],['@babel/plugin-transform-private-property-in-object', { loose: true }]]
}

重启运行
在这里插入图片描述
ok,最基础的完成了

因为我的项目没有用ts,所以没有用ts的写法
但我要集成的react组件全是用ts写的
后面看看是自行转化成js还是装ts依赖库以支持运行

http://www.dtcms.com/wzjs/133638.html

相关文章:

  • 重庆商城网站建设emlog友情链接代码
  • 做便宜网站免费大数据网站
  • 商务网站建设中存在的问题广州排前三的seo公司
  • 上海高端网站建设服务公司百度指数可以查询到哪些内容
  • 外贸 网站 seo怎么宣传网站
  • php做的大型网站有哪些营销网站系统
  • 做纯净系统的网站深圳网络营销怎么推广
  • 限制WordPress站点怎么样在百度上免费推广
  • 福州网站建设咨询太原关键词排名优化
  • 网站如何做电脑和手机软件外贸公司如何做推广
  • 昆明做网站建设的公司哪家好网站维护需要学什么
  • 跨境电商是什么意思搜索引擎优化包括哪些内容
  • 如何做网页广告建站优化公司
  • golang网站开发宣传推广的十种方式
  • python源代码大全站长工具seo下载
  • 推广普通话喜迎二十大的手抄报简单镇江交叉口优化
  • 编程除了做网站还能干什么网络营销优秀案例
  • 网站模板编辑软件seo顾问阿亮博客
  • 浙江网站建设方案优化武汉seo搜索引擎优化
  • 做网站的必要各种网站
  • 网站制作的英文关键词推广seo
  • wap卖料建站系统深圳网络推广代理
  • 大学电子商务网站建设今日竞彩足球最新比赛结果查询
  • 天水做网站电话品牌推广策划方案案例
  • 建网站需要注意的问题企业网站开发公司
  • 寿县有做网站开发的吗seo排名优化方式方法
  • 网站建设合同模板91075百度sem竞价
  • 企业网站 seo怎么做推广普通话文字内容
  • 浙江省网站建设公司网络营销课程大概学什么内容
  • 如东做网站公司整站seo