>本教程演示了使用CANJS构建实时待办事项列表应用程序,利用Github的问题列表和Webhook API进行动态更新。 该应用程序显示CANJS的MVVM架构及其关键软件包:can-component
,can-connect
,can-define
和can-stache
。 jQuery UI可以通过拖放重新排序增强交互性。
关键特征和学习成果:
>>
数据模型():
应用程序模型单个问题和使用can-define
can-define/map/map
can-define/list/list
Issue
import DefineMap from 'can-define/map/map';
const Issue = DefineMap.extend('Issue', {
id: 'number',
title: 'string',
sort_position: 'number',
body: 'string'
});
,类似车把的模板引擎,以渲染HTML UI。 示例:can-stache
can-stache
<code class="language-html"><ol> {{#each issues}} <li>{{title}}</li> {{/each}} </ol></code>>
>组件():can-stache
项目设置:can-component
index.html
>,app.css
,app.js
)。index.html
样式使用app.css
>使用github-issue-server
>
github-issues
can-connect
创建问题:sortable
完整的源代码可在GitHub上获得(原始文章中提供的链接)。 教程以常见问题解答部分结束,涉及有关CANJ和GitHub集成的常见问题。以上是如何使用CANJS构建实时github问题待办事项清单的详细内容。更多信息请关注PHP中文网其他相关文章!