vue-sails-promise
v0.1.22
Published
Integration with the Sails framework for Vue.js
Downloads
7
Readme
vue-sails-promise
Sails is the most popular MVC framework for Node.js. Vue-Sails-Promise is a plugin for Vue.js that integrates it with Sails.
NOTE: It's supposed to be compatible both with Vue 1.x and 2.x. It requires IE9+ or Safari 5+
Install
npm install vue-sails-promise
Usage
// Include and set up Sails client
const socketIOClient = require('socket.io-client');
const sailsIOClient = require('sails.io.js');
const io = sailsIOClient(socketIOClient);
// Additional Sails.io.js configuration
// io.sails.url = 'http://localhost:1337';
// io.sails.environment = process.env.NODE_ENV || 'development';
// Include vue-sails-promise as a CommonJS module
const Vue = require('vue');
const vueSails = require('vue-sails-promise');
// Enable the plugin globally
Vue.use(vueSails, io)
Now in every component you get a new property called $io
, which allows you to interact with the Sails socket client:
this.$io.get(url, data).then(res => ...)