Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
143 views
in Technique[技术] by (71.8m points)

reactjs - Converting a vue.js plugin to react.js component

I am just trying to convert a third party vue.js plugin (polygoncropper) to reactjs component in my reactjs application. I have abit changed the plugin and pushed the codes to my repository

I then build the plugin by using

vue-cli-service build --target wc --name my-app src/App.vue

There is no issue with generated html and js files and I can sucessfuly run the plugin by the js generated file, however I am not sure how to use that inside my react application

I am just using the generated script (js file inside dis folder) like below inside my react application

import "components/PolygonCropper/my-app.js";

I am getting below error when I compile my react.js application

Failed to compile.

./src/components/PolygonCropper/my-app.js
  Line 139:4:      Expected an assignment or function call and instead saw an expression  no-unused-expressions
  Line 3990:475:   Expected an assignment or function call and instead saw an expression  no-unused-expressions
  Line 3990:1058:  Expected an assignment or function call and instead saw an expression  no-unused-expressions
  Line 3990:1238:  Expected an assignment or function call and instead saw an expression  no-unused-expressions
  Line 3990:1435:  Expected an assignment or function call and instead saw an expression  no-unused-expressions
  Line 37299:5:    Expected an assignment or function call and instead saw an expression  no-unused-expressions
  Line 37304:10:   Unexpected use of 'self'                                               no-restricted-globals
  Line 37304:33:   Unexpected use of 'self'                                               no-restricted-globals
  Line 37388:18:   'Vue' is not defined                                                   no-undef
  Line 37949:16:   Unexpected use of 'self'                                               no-restricted-globals
  Line 37949:36:   Unexpected use of 'self'                                               no-restricted-globals

Can you help me convert that vue.js plugin to a react component successfully?

question from:https://stackoverflow.com/questions/65623194/converting-a-vue-js-plugin-to-react-js-component

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...