bind:expression on field
当field为集合时,集合对象调用insert或remove添加或删除对象时,未触发事件。仅在集合为空时会执行一次。
html代码如下:
<div id=\"orgUsersTable\"> <template name=\"operations\"> <div><div c-onclick=\"showUserRoleSet(user)\" c-bind=\"mappingUserRoleSet(user.roleSet) on user.roleSet\"></div></div></template></div>
js代码如下:
var roleSet = curUser.get("roleSet"); if(!roleSet){ roleSet = [{id:data,roleName:curRole.get('roleName'),systemName:curRole.get('systemName')}]; } else { roleSet.insert({id:data, roleName:curRole.get('roleName'),systemName:curRole.get('systemName')}); }
当roleSet为空时,触发了mappingUserRoleSet方法,渲染成功,其它时候均不再触发mappingUserRoleSet。
bind:expression on field
当field为集合时,集合对象调用insert或remove添加或删除对象时,未触发事件。仅在集合为空时会执行一次。
html代码如下:
<div id=\"orgUsersTable\"> <template name=\"operations\"> <div><div c-onclick=\"showUserRoleSet(user)\" c-bind=\"mappingUserRoleSet(user.roleSet) on user.roleSet\"></div></div></template></div>js代码如下:
var roleSet = curUser.get("roleSet"); if(!roleSet){ roleSet = [{id:data,roleName:curRole.get('roleName'),systemName:curRole.get('systemName')}]; } else { roleSet.insert({id:data, roleName:curRole.get('roleName'),systemName:curRole.get('systemName')}); }当roleSet为空时,触发了mappingUserRoleSet方法,渲染成功,其它时候均不再触发mappingUserRoleSet。