Knockout

Knockout 使得用JavaScript创建富响应的ui变得更加容易。(Knockout makes it easier to create rich, responsive UIs with JavaScript.)

Github星跟蹤圖

Knockout是一个JavaScript MVVM(MVC的现代版本)库,可以更容易地使用JavaScript和HTML创建丰富的、类似桌面的用户界面。 它使用观察器使您的UI自动保持与底层数据模型同步,以及一组功能强大且可扩展的声明性绑定,以实现高效开发。

最大的特点:
  • 优雅的依赖关系跟踪 - 每当您的数据模型更改时,自动更新UI的正确部分。
  • 声明式绑定 —— 一个简单明了的方法来将UI的部分连接到数据模型。您可以使用任意嵌套的绑定上下文轻松构建复杂的动态UI。
  • 简单可扩展 —— 将自定义行为实现为新的声明性绑定,以便在几行代码中轻松重用。
额外的优点:
  • 纯JavaScript库 —— 适用于任何服务器或客户端技术
  • 可以添加到现有的Web应用程序之上,而不需要重大的架构更改
  • 紧凑 —— gzip压缩后大约13kb
  • 适用于任何主流浏览器(IE 6+,Firefox 2+,Chrome,Safari,Edge等)
  • 全面的规格套件(开发BDD风格)意味着其正确的功能可以在新的浏览器和平台上轻松验证

熟悉Ruby on Rails,ASP.NET MVC或其他MV *技术的开发人员可能会将MVVM视为具有声明性语法的MVC实时形式。在另一个意义上,您可以将KO视为将UI编辑为JSON数据的一般方式...无论为您工作如何:)

概覽

名稱與所有者knockout/knockout
主編程語言JavaScript
編程語言JavaScript (語言數: 4)
平台
許可證Other
發布數44
最新版本名稱v3.5.1 (發布於 2019-11-05 12:21:30)
第一版名稱v1.0.0 (發布於 )
創建於2010-07-05 08:08:34
推送於2022-12-29 22:53:39
最后一次提交2021-09-06 20:15:16
星數10.4k
關注者數528
派生數1.5k
提交數1.8k
已啟用問題?
問題數1849
打開的問題數298
拉請求數372
打開的拉請求數71
關閉的拉請求數311
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?

Knockout

Knockout is a JavaScript MVVM (a modern variant of MVC) library that makes it easier to create rich, desktop-like user interfaces with JavaScript and HTML. It uses observers to make your UI automatically stay in sync with an underlying data model, along with a powerful and extensible set of declarative bindings to enable productive development.

Getting started

Join the chat at https://gitter.im/knockout/knockout

Totally new to Knockout? The most fun place to start is the online interactive tutorials.

For more details, see

Downloading Knockout

You can download released versions of Knockout from the project's website.

For Node.js developers, Knockout is also available from npm - just run npm install knockout.

Building Knockout from sources

If you prefer to build the library yourself:

  1. Clone the repo from GitHub

    git clone https://github.com/knockout/knockout.git
    cd knockout
    
  2. Acquire build dependencies.

    Make sure you have Node.js installed on your workstation. This is only needed to build Knockout from sources. Knockout itself has no dependency on Node.js once it is built (it works with any server technology or none). Now run:

    npm install -g grunt-cli
    npm install
    

    The first npm command sets up the popular Grunt build tool. You might need to run this command with sudo if you're on Linux or Mac OS X, or in an Administrator command prompt on Windows. The second npm command fetches the remaining build dependencies.

  3. Run the build tool

    grunt
    

    Now you'll find the built files in build/output/.

Running the tests

If you have phantomjs installed, then the grunt script will automatically run the specification suite and report its results.

Or, if you want to run the specs in a browser (e.g., for debugging), simply open spec/runner.html in your browser.

License

MIT license - http://www.opensource.org/licenses/mit-license.php

去到頂部