Comments (10)
Still if you are having issue with browserify + vuejs and if
var Vue = require('vue');
new Vue({
el: '#app',
data: {
message: 'Hello Vue!'
}
})
not working then use aliasify
npm install aliasify --save-dev
in package.json
"aliasify": {
"aliases": {
"vue": "vue/dist/vue.js"
}
},
"browserify": {
"transform": [ "aliasify" ]
}
then in js file simple call
var Vue = require('vue');
2nd alternative is (without aliasify) -
just use
var Vue = require('vue/dist/vue.js');
it should work!
from vue-resource.
Here's some info on the plugin interface: http://vuejs.org/guide/extending.html#Extend_with_Plugins
vue-resource auto-installs itself only when it finds a global Vue
on window, but in CommonJS there's no global exposed, so you have to manually install it.
from vue-resource.
Just require('vue-resource')
.
But you do need to install it explicitly:
Vue.use(require('vue-resource'))
from vue-resource.
I am also struggling with this...
I am trying to use a vue-resource.js file I have on disk, like this:
var Vue = require('./vue');
require('./vue-resource');
I have also tried Vue.use(require('vue-resource'))
but I can't get it to work...
In the first case I get a post not defined
error. In the second case I get Uncaught TypeError: undefined is not a function
from vue-resource.
Ahh, I just noticed this package is not on npm. I'll publish it if that's ok with you, @steffans .
@jlem @slickorange in Browserify the require
call follows the resolution algorithm of Node modules, so if you clone this repo into ./node_modules
of your project, then you should be able to just require('vue-resource')
.
from vue-resource.
Update: it's now on npm. Just npm install vue-resource
and you can require('vue-resource')
directly.
from vue-resource.
Still not working...
Here is the code for my main.js file. I am trying to use this in components but I have commented out the components and added a test method that I call by clicking a button.
When clicking the button I still get the post not defined
error... I would appreciate any help. I am pretty new to most of this so excuse any stupid errors.
var Vue = require('./vue.js');
require('vue-resource');
new Vue({
el: '#app',
components: {
//searchcard: require('./components/search-card')
//quoteitems: require('./components/quote-items')
},
methods: {
test: function(){
console.log('test');
this.$http.post('/search/',
{'test' : 'test'})
}
}
});
from vue-resource.
Ah. When you load it in CommonJS, it doesn't auto-install itself. You need to install it:
var Vue = require('vue')
var Resource = require('vue-resource')
Vue.use(Resource)
from vue-resource.
Thanks for the insanely quick help :) That did the trick...
Where could I have read up on this to understand it myself? I tried looking through the docs, but I did not see anything.
from vue-resource.
work, thanks
from vue-resource.
Related Issues (20)
- IE11 issue with executor.bind
- Update got dependency?
- uploadProgress is not triggered?
- Please mark the repository as not maintained or give it to the community HOT 3
- How to prevent a console.error on certain GET requests?
- Vue Resource Always throwing in error callback in firefox
- change the url in Vue.http.interceptors with asynchronous methods
- IE11 xhr.send(undefined) sends 'undefined' string as POST payload
- Setting root does not take effect HOT 6
- request.abort() is not there
- Is this package still being maintained? HOT 2
- Catch is not recognized in promise
- Error firefox IPV6 VUE.JS vue-resource.common.js XMLHttpRequest
- Upgrade got HOT 3
- Trying to get in touch regarding a security issue
- how use vue-resource in composition API HOT 1
- Any plans for Vue 3 support? HOT 3
- The field is converted to undefined HOT 1
- Can I use this package for SEO optimisation tasks?
- HTTP-semantics high vulnerability - update got dependency
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-resource.