-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Vue 3 with VueAxios via CDN #82
Comments
@djom202 seems like it isn't |
Hi @imcvampire, Also I'm trying to use in vue v2 and it's happing the same, I'm just importing the dependencies and trying to use it. // main.js
import Vue from 'vue'
import axios from 'axios'
import VueAxios from 'vue-axios'
Vue.use(VueAxios, axios) // helper file
import Vue from 'vue'
exports.urlShorter = async (url, alias) => {
const request = `https://api.php?key=${process.env.VUE_APP_APIKEY}&short=${encodeURI(url)}&name=${alias}`
console.log('this.axios', this.axios)
console.log('this.$http', this.$http)
console.log('Vue.axios', Vue.axios)
const resp = await this.$http.get(request).then(response => {
console.log(response.data)
})
console.log('resp', resp)
} |
I am having the same problem as @msg7086. The provided HTML causes the given exception. Same with vue-axios 3.2.4 and when the files are linked with a |
Is this what are you using? https://jsfiddle.net/imcvampire/t8a0yjbp/3/ |
The error message with that test is "Uncaught ReferenceError: exports is not defined". I was using |
Maybe, Vue doesn't export |
It does: The instructions for using a plugin have changed between version 2 instructions and version 3 instructions. Instead of I think the right solution is to check for if (typeof exports == "object") {
module.exports = plugin;
} else if (typeof define == "function" && define.amd) {
define([], function(){ return plugin });
} else if (window.Vue && window.axios && window.Vue.use) {
Vue.use(plugin, window.axios);
} |
@gregbaker Nice, thank you! If you're okay, feel free to create a merge request. |
How to reproduce:
Error message:
Vue.use has been removed in Vue 3.
The text was updated successfully, but these errors were encountered: