I'm trying to integrate commerce.js in vue 3... I have an error when I try to integrate commerce as a global plugin enter image description here
In my browser i have a wite screen with this message in my console:
Uncaught TypeError: Cannot read properties of undefined (reading 'mixin')
at eval (main.js?fbea:17:1)
at ./src/main.js (app.js:85:1)
at __webpack_require__ (app.js:337:33)
at app.js:1518:109
at __webpack_require__.O (app.js:383:23)
at app.js:1519:53
at app.js:1521:12
Firstly, it looks like the way you are doing mixins is not the right way in Vue3. Your syntax looks like it would work with Vue2, but not Vue3. See below for an example:
createApp({
extends: App,
mixins: [your mixins here..],
}).mount('#app')
See this answer https://stackoverflow.com/a/68492165/20053031
I'd recommend just importing this library where it's required.. such as a Checkout
component if it's only needed in certain places.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.