Way.js —— 轻量级的 JavaScript 双向数据绑定库

Way.js 详细介绍
Way.js 是一个简单轻量级、持久化的 JavaScript 库,用来绑定 DOM 元素和内存中的数据。是一个超级简单的双向数据绑定库。

示例代码:

<form way-data="myFormData" way-persistent="true">
    <input type="text" name="name">
    <input type="text" name="age">
    <input type="text" name="gender">
</form>

Name: <span way-data="myFormData.name"></span>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Bindable.js 实现了灵活、快速的双向数据绑定JavaScript 。 Two-way data binding means linking properties of two separate objects - when one changes, the other will automatically update with that change.  It enables much easier interactions between data models and UIs, among other uses outside of MVC. Bindable.js is similar to Ember's data-binding system, except it doesn't include anything View related, so the library has many use-cases - whether replacing Backbone's Model, providing a way to maintain the state between server <-> client for a realtime front-end application (similar to Firebase), or perhaps a way to communicate between server <-> server for a realtime distributed Node.js application. Projects using bindable.js Paperclip.js - data-bindable templating engine. Sherpa.js - online tours library Mojo.js - javascript MVC framework. AWSM - aws library. ditto - synchronized user interactions across browsers. 示例代码: var bindable = require("bindable"); var person = new bindable.Object({   name: "craig",   last: "condon",   location: {     city: "San Francisco"   } }); person.bind("location.zip", function(value) {   // 94102 }).now(); //triggers the binding person.set("location.zip", "94102");  //bind location.zip to another property in the model, and do it only once person.bind("location.zip", { to: "zip", max: 1 }).now(); //bind location.zip to another object, and make it bi-directional. person.bind("location.zip", { target: anotherModel, to: "location.zip", bothWays: true }).now(); //chain to multiple items, and limit it! person.bind("location.zip", { to: ["property", "anotherProperty"], max: 1 }).now(); //you can also transform data as it's being bound person.bind("name", {   to: "name2",   map: function (name) {     return name.toUpperCase();   } }).now(); 标签:Bindable
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值