本文整理汇总了TypeScript中js/model.js.Model类的典型用法代码示例。如果您正苦于以下问题:TypeScript js.Model类的具体用法?TypeScript js.Model怎么用?TypeScript js.Model使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了js.Model类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: delOneTodo
delOneTodo(e){
let el = e.target.getAttribute('data-id'),
locMapObj = this.m.removeItem(el);
this.htmlRender();
View.insert(this.m.getTpl().el[1], locMapObj.size);
Model.delClass(this.m.getTpl().classItem[2]);
}
示例2: filters
filters(e){
let objLocal = this.m.filters(e),
classesList = e.target.classList;
this.htmlRender(objLocal);
Model.addClass(this.m.getTpl().el[2], this.m.getTpl().classItem[2], 3, classesList);
if(objLocal){
//insert quantity of todos.
View.insert(this.m.getTpl().el[1], objLocal.size);
}
}
示例3: checkInputTodo
checkInputTodo(e) {
if(e.keyCode === 13 && e.target.value.replace(/(\s)+/g, '').length > 0 ){
Model.delClass(this.m.getTpl().classItem[2]);
if(e.target.id === 'todos__insert-item'){
this.m.addTodoItem(e.target);
e.target.value = '';
this.htmlRender();
View.insert(this.m.getTpl().el[1], this.m.getObj().size);
} else {
let el = e.target.getAttribute('data-id');
this.m.editTodo(el, e.target.value, this.m.getObj());
this.htmlRender();
View.insert(this.m.getTpl().el[1], this.m.getObj().size);
Model.addClass(el, this.m.getTpl().classItem[3], 2);
}
}
e.target.removeEventListener('keypress', this.checkInputTodo);
}
示例4: constructor
constructor(enteredTodo){
this.enteredTodo = enteredTodo;
this.m = new Model();
this.v = new View(this.m.getObj(),
this.m.getTpl());
}
示例5: checkAllTodos
checkAllTodos(e){
if(e.target.checked === true) {
this.m.selectAll('checked');
}
if (e.target.checked === false) {
this.m.selectAll('');
}
this.htmlRender();
}
示例6: checkOneTodo
checkOneTodo(e){
let el = e.target.getAttribute('data-id');
if(e.target.checked === true) {
this.m.selectTodo(el);
}
if(e.target.checked === false) {
this.m.selectTodo(el);
}
this.htmlRender();
}
示例7:
el.addEventListener('dblclick', (e) => {
let ev = e;
if(e.target.tagName === 'LABEL') {
let todoEditId = ev.target.children[0];
this.m.todoEditMode(ev, todoEditId);
}
}, false);
示例8: htmlRender
htmlRender(mapObj = this.m.getObj()){
this.v.renderTpl(mapObj);
this.m.checkView(this.m.getObj(), this.m.getTpl());
}