文件名称:数据双向绑定库brix-bisheng.zip
文件大小:197KB
文件格式:ZIP
更新时间:2022-08-06 23:41:46
开源项目
brix-bisheng 是纯粹的数据双向绑定库。安装 Install$ bower install --save brix-bisheng'用法 Usage// 配置 Brix BiSheng 和依赖库require.config({ paths: { jquery: 'bower_components/jquery/dist/jquery', underscore: 'bower_components/underscore/underscore', handlebars: 'bower_components/handlebars/handlebars' 'brix/bisheng': 'bower_components/brix-bisheng/dist/bisheng' } })// 加载 Brix BiShengrequire(['jquery', 'brix/bisheng'], function($, BiSheng){ // HTML 模板 var tpl = '{{title}}' // 数据对象 var data = { title: 'foo' } // 执行双向绑定 var bs = BiSheng.bind(data, tpl, function(content){ // 然后在回调函数中将绑定后的 DOM 元素插入文档中 $('div.container').append(content) }); // 改变数据 data.title,对应的文档区域会更新 bs.apply(function() { data.title = 'bar' }) })方法 Methods共计 6 个公开方法:BiSheng.bind( data, tpl, callback )BiSheng.unbind( data, tpl ) DEPRECATEDBiSheng.watch( data, handler( changes ) )BiSheng.unwatch( data, handler )BiSheng.apply( handler ) DEPRECATEDBiSheng.auto( bool ) 标签:brixbisheng
【文件预览】:
brix-bisheng-master
----.jshintrc(105B)
----bower.json(477B)
----src()
--------brix()
----demo()
--------demo.bisheng.bug.html(2KB)
--------bower.json(194B)
--------fb.js(52KB)
--------demo.bisheng.tmp.html(3KB)
--------demo.bisheng.html(6KB)
----doc()
--------dependencies.png(125KB)
----gulpfile.js(3KB)
----test()
--------test.bisheng.helper.js(2KB)
--------test.bisheng.attribute.js(6KB)
--------test.bisheng.html(2KB)
--------test.bisheng.locator.js(7KB)
--------bower.json(202B)
--------test.bisheng.loop.js(5KB)
--------test.bisheng.ast.js(1KB)
--------test.bisheng.watch.js(7KB)
--------test.bisheng.expression.js(9KB)
--------test.bisheng.block.js(15KB)
--------test.bisheng.form.js(16KB)
--------test.bisheng.mode.js(2KB)
----README.md(8KB)
----dist()
--------bisheng-debug.js(88KB)
--------bisheng.js(20KB)
----.gitignore(63B)
----demo.html(3KB)
----package.json(465B)