在自定义组件中配置图片,使用了React常规的显示本地图片的方法,运行后Mendix网页报错,请问该怎么解决呢?
"scripts": { "start": "pluggable-widgets-tools start:server --open", "dev": "pluggable-widgets-tools start:web", "build": "pluggable-widgets-tools build:web", "postbuild": "./node_modules/.bin/gulp --gulpfile gulp.js build", "lint": "pluggable-widgets-tools lint", "lint:fix": "pluggable-widgets-tools lint:fix", "test": "pluggable-widgets-tools test:unit:web --no-cache --ci && npm run test:e2e", "test:unit": "pluggable-widgets-tools test:unit:web --coverage", "test:e2e": "pluggable-widgets-tools test:e2e --url \"https://badge.mxapps.io\"", "test:e2e:dev": "pluggable-widgets-tools test:e2e --debug", "prerelease": "npm run lint", "release": "pluggable-widgets-tools release:web" },
添加 postbuild
gulp.js
然后你把文件放 /resource 文件夹就可以了
找到一个暂时解决问题的方法:
上传到Mendix的Image collection文件的图片,项目运行后会保存到\deployment\web\img下。
在浏览器控制台查看该图片的来源,可以发现地址是
添加 postbuild
gulp.js
然后你把文件放 /resource 文件夹就可以了