markdown Integrasi Feathers dengan Vuex通过Feathersvuex
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Integrasi Feathers dengan Vuex通过Feathersvuex相关的知识,希望对你有一定的参考价值。
import Vue from 'vue'
import Vuex from 'vuex'
import feathersVuex from 'feathers-vuex'
import Api from './api'
const { service, auth, FeathersVuex } = feathersVuex(Api, { })
Vue.use(Vuex)
Vue.use(FeathersVuex)
export default new Vuex.Store({
state: {
},
mutations: {
},
actions: {
},
plugins: [
service('users'),
// Setup the auth plugin.
auth({ userService: 'users' })
]
})
import feathers from '@feathersjs/feathers'
import socketio from '@feathersjs/socketio-client'
import auth from '@feathersjs/authentication-client'
import io from 'socket.io-client'
const socket = io('http://localhost:4937', { transports: ['websocket'] })
const Api = feathers()
.configure(socketio(socket))
.configure(auth({ storage: window.localStorage }))
export default Api
# Implementasi feathers-vuex
Instal paket yang dibutuhkan untuk melakukan integrasi feathersjs dengan Vue
``` bash
$ yarn add @feathersjs/feathers @feathersjs/socketio-client @feathersjs/authentication-client socket.io-client feathers-vuex
```
Initialisasi feathers client di dalam file `src/api.js`
Integrasi feathers ke dalam local store Vue di file `src/store.js`
以上是关于markdown Integrasi Feathers dengan Vuex通过Feathersvuex的主要内容,如果未能解决你的问题,请参考以下文章