将Feathers客户集成到Vuex
羽毛-vuex (feathers-vuex)
feathers-vuex
is a first class integration of the Feathers Client and Vuex. It implements many Redux best practices under the hood, eliminates a lot of boilerplate code, and still allows you to easily customize the Vuex store.
feathers-vuex
是Feathers Client和Vuex的一流集成。 它在后台实现了许多Redux最佳实践,消除了很多样板代码,并且仍然允许您轻松自定义Vuex存储。
特征 (Features)
Fully powered by Vuex & Feathers
由Vuex&Feathers完全提供动力
Realtime By Default
默认为实时
Actions With Reactive Data
React性数据的操作
Local Queries
本地查询
Fall-Through Caching
直通缓存
Feathers Query Syntax
羽毛查询语法
$FeathersVuex Vue Plugin
$ FeathersVuex Vue插件
Live Queries
实时查询
Per-Service Data Modeling
每服务数据建模
Clone & Commit
克隆并提交
Vuex Strict Mode
Vuex严格模式
Per-Record Defaults
每个记录的默认值
Data Level Computes
数据级计算
Relation Support
关系支持
安装 (Installation)
npm install feathers-vuex --save
基本范例 (Basic Examples)
To setup feathers-vuex
, we first need to setup a Feathers Client. Here's an example using the latest @feathersjs
npm packages.
要设置feathers-vuex
,我们首先需要设置Feathers Client。 这是使用最新的@feathersjs
npm软件包的示例。
feathers-client.js:
feathers-client.js:
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:3030', {transports: ['websocket']})const feathersClient = feathers().configure(socketio(socket)).configure(auth({ storage: window.localStorage }))export default feathersClient
And here's how you would integrate the Feathers Client into the Vuex store:
这是将Feathers Client集成到Vuex商店中的方法:
store/index.js:
store / index.js:
import Vue from 'vue'
import Vuex from 'vuex'
import feathersVuex from 'feathers-vuex'
import feathersClient from '../feathers-client'const { service, auth, FeathersVuex } = feathersVuex(feathersClient, { idField: '_id' })Vue.use(Vuex)
Vue.use(FeathersVuex)export default new Vuex.Store({plugins: [service('todos'),// Specify custom options per serviceservice('/v1/tasks', {idField: '_id', // The field in each record that will contain the idnameStyle: 'path', // Use the full service path as the Vuex module name, instead of just the last sectionnamespace: 'custom-namespace', // Customize the Vuex module name. Overrides nameStyle.autoRemove: true, // Automatically remove records missing from responses (only use with feathers-rest)enableEvents: false, // Turn off socket event listeners. It's true by defaultaddOnUpsert: true, // Add new records pushed by 'updated/patched' socketio events into store, instead of discarding them. It's false by defaultskipRequestIfExists: true, // For get action, if the record already exists in store, skip the remote request. It's false by defaultmodelName: 'OldTask' // Default modelName would have been 'Task'})// Add custom state, getters, mutations, or actions, if needed. See example in another section, below.service('things', {state: {},getters: {},mutations: {},actions: {}})// Setup a service with defaults for Model instancesservice('manufacturers', {instanceDefaults: {name: ''}})// Setup a service with light-weight relational dataservice('models', {instanceDefaults: {name: '',manufacturerId: '',manufacturer: 'Manufacturer' // Refers to data (populated on the server) that gets put in the `manufacturers` vuex store.}})// Setup the auth plugin.auth({ userService: 'users' })]
})
翻译自: https://vuejsexamples.com/integrate-the-feathers-client-into-vuex/
将Feathers客户集成到Vuex相关推荐
- Nuxt爬坑系列之vuex
坑的背景介绍 要用 bootstrap-vue 这个vue的ui框架来重构公司的官网,因为公司官网之前使用bootstrap搭建的,现在想用nuxt框架来重构,恰好bootstrap出了结合vue的版 ...
- 集成 AquaLogic BPM Suite 6.0 和 AquaLogic Service Bus
集成 AquaLogic BPM Suite 6.0 和 AquaLogic Service Bus 作者:Alex Toussaint 07/11/2007 摘要 AquaLogic BPM Su ...
- OneAPM CI与阿里云容器服务集成
应用监控是在生产环境使用Docker的重要条件.阿里云容器服务不但提供了核心的容器和宿主机监控能力,而且支持客户集成自己的监控解决方案,这样可以让容器服务平台融合到自己企业的IT管控之下.今天我们会以 ...
- 3项目里面全局用less变量 cli vue_Vue实战14——抽离全局less变量与Vuex持久化、多模块构建...
上文中说到了利用Element-ui优化了导航栏,本节介绍抽离公共的less变量与利用Element-Ui实现登录注册页面.本项目git地址: https://gitee.com/vuejslearn ...
- cdh中hue集成hbase_HBase版本 | Cloudera Enterprise 6.2.0发布
Cloudera在北京时间2019年3月30日正式发布了Cloudera Enterprise 6.2.0,此版本包括了许多新功能,可用性改进以及性能提升.Cloudera Enterprise 6. ...
- 客户案例 | 初窥元宇宙,Oasis让更多人找到第二人生
在国内互联网产品激战正酣之际,扬帆出海的破局者却频频出现,特别是一带一路新兴市场红利的显现,越来越多的企业开始布局海外并交出亮眼成绩! 即构成立以来,在海外进行了大量网络节点部署,并服务 Uplive ...
- A1333:具有安全关键应用集成诊断功能的精密、高速、霍尔效应角度传感器 IC
A1333 是 360° 角度传感器 IC,它提供基于磁性圆形垂直霍尔效应(CVH)技术的非接触式高分辨率角位置信息.它具有系统级芯片(SoC)架构,包括:CVH前端.数字信号处理和电机换向(UVW) ...
- 旺店通与用友U8集成解决方案
方案简介 由于办公协同系统负责审批事件为主,而传统ERP系统缺乏多样的审批流程,不能完成多人对一个事件进行审批同意实施,不方便采购.销售.出库申请单的审批,以及费用报销.出差.合同签订等申请,结合两者 ...
- 旺店通与金蝶集成解决方案
方案简介 由于办公协同系统负责审批事件为主,而传统ERP系统缺乏多样的审批流程,不能完成多人对一个事件进行审批同意实施,不方便采购.销售.出库申请单的审批,以及费用报销.出差.合同签订等申请,结合两者 ...
最新文章
- 后处理没有pui文件怎么打开_UG后处理添加具体步骤
- 借入单的后续处理-借入归还
- centos 7 安装 npm 工具
- c语言错误re,c语言malloc之后再realloc的有关问题
- 关于oracle数据库论文,Oracle数据库研究论文 有关Oracle数据库的论文
- 安卓应用安全指南 4.2.2 创建/使用广播接收器 规则书
- 当心币圈高仿号!也别指望AI,它有心无力
- 前景检测算法(一)--综述
- SOP24/SSOP24低功耗LCD驱动芯片VK1056B规格书下载
- 小度计算机笔记,开售告罄、口碑炸裂、高语音交互率的小度耳机全新升级语音笔记...
- Kaldi的安装与测试
- Newkirk effect and Morton effect
- gbd调试器及静态库/动态库的制作
- notebook pip install 只有星号_什么人不能种生基?什么人适合于做?只有这篇文章最清楚了!...
- 稀疏数组——优化五子棋游戏的小技巧
- 计算机游戏本和商务本的区别,商务本和游戏本有什么区别
- 华为任正非:实事求是的科研方向与二十年的艰苦努力
- Python零基础之自动登录12306
- The error may involve mapper.UserMapper.AddUser-Inline
- 明伟LRS-350-24方案,送BOM表,原理图、PCB