colaui基础
监控 c-watch
// 监控的方法函数 on 监控的参数名字
div(c-watch="fun on style" c-bind="styles") // js
fun(dom,model){
console.log(dom) // 直接获取dom,只触发一次
dom.style.background = 'red'
console.log(model) // 获取到的dom
},
类名样式c-class
// html
div(c-class="styles == 'red' ? 'blue' :'red'") // js
model.set('styles','red')
button(c-onclick="changes()") 按钮 changes(){
if(model.get('styles') == 'red'){
model.set('styles','blue')
}else{
model.set('styles','red')
}
console.log(model.get('styles'))
},
行间样式 c-style
// html
div(c-style="color:bgColor")颜色改变
div(c-style="fontSize:30") 直接写死 // 引入js
append scripts
script(src="policycenter/atest/atest.js") //js
model.set('bgColor','red')
隐藏c-display
<span c-bind="isshow"></span>
<button c-onclick="change()" c-bind="isshow">anniu</button> model.set('isshow', true)
// 需要放在cola里面
model.action({
change() {
if (model.get('isshow')) {
console.log()
model.set('isshow', false)
} else {
model.set('isshow', true)
}
}
})
定义别名
// 定义的路径 as 改的名字
div(c-alias="items as it")
// 下面试循环
div(c-repeat="item in it" c-bind="item.age") cola(function(model){
model.set('items',[
{'name':'x','age':},
{'name':'a','age':},
{'name':'q','age':}
])
})
定义script
extends /_page append head
block body
div(c-alias="directions as ds")
li(c-repeat="d in ds" c-bind="d.text")
append scripts
script.
cola(function (model) {
model.set("directions", [
{value: "east", text: "东"},
{value: "south", text: "南"},
{value: "west", text: "西"},
{value: "north", text: "北"}
]);
}); append scripts
script(src="policycenter/atest/atest.js")
循环 c-repeat
// 和vue绑定事件一样;
// c-bind用于双相绑定和显示
div(c-repeat="item in items" c-bind="item.age") cola(function(model){
model.set('items',[
{'name':'x','age':},
{'name':'a','age':},
{'name':'q','age':}
])
})
双向绑定 c-bind
// 事件绑定
spn(c-bind="name")
c-input(type="text" c-bind="name") cola(function(model){
model.set('name','xioaming');
})
获取自己的value值
lonePrincipalChange(self,arg) {
var lonePrincipal = Number(self.get("value"));
},
获取值
获取值理论上讲 遇到循环就用current
console.log(model.get("actual.plcSolution.plcPackage.plcMainClause.$oriCurAmount"))
console.log(model.get("actual.plcSolution.plcPackage").current.get('plcMainClause.$oriCurAmount'))
检查这个字段有没有数据
cola.util.dictionary('VehicleUseNature')
colaui基础的更多相关文章
- java基础集合经典训练题
第一题:要求产生10个随机的字符串,每一个字符串互相不重复,每一个字符串中组成的字符(a-zA-Z0-9)也不相同,每个字符串长度为10; 分析:*1.看到这个题目,或许你脑海中会想到很多方法,比如判 ...
- node-webkit 环境搭建与基础demo
首先去github上面下载(地址),具体更具自己的系统,我的是windows,这里只给出windows的做法 下载windows x64版本 下载之后解压,得到以下东西 为了方便,我们直接在这个目录中 ...
- js学习笔记:webpack基础入门(一)
之前听说过webpack,今天想正式的接触一下,先跟着webpack的官方用户指南走: 在这里有: 如何安装webpack 如何使用webpack 如何使用loader 如何使用webpack的开发者 ...
- Golang, 以17个简短代码片段,切底弄懂 channel 基础
(原创出处为本博客:http://www.cnblogs.com/linguanh/) 前序: 因为打算自己搞个基于Golang的IM服务器,所以复习了下之前一直没怎么使用的协程.管道等高并发编程知识 ...
- [C#] C# 基础回顾 - 匿名方法
C# 基础回顾 - 匿名方法 目录 简介 匿名方法的参数使用范围 委托示例 简介 在 C# 2.0 之前的版本中,我们创建委托的唯一形式 -- 命名方法. 而 C# 2.0 -- 引进了匿名方法,在 ...
- HTTPS 互联网世界的安全基础
近一年公司在努力推进全站的 HTTPS 化,作为负责应用系统的我们,在配合这个趋势的过程中,顺便也就想去搞清楚 HTTP 后面的这个 S 到底是个什么含义?有什么作用?带来了哪些影响?毕竟以前也就只是 ...
- Swift与C#的基础语法比较
背景: 这两天不小心看了一下Swift的基础语法,感觉既然看了,还是写一下笔记,留个痕迹~ 总体而言,感觉Swift是一种前后端多种语言混合的产物~~~ 做为一名.NET阵营人士,少少多多总喜欢通过对 ...
- .NetCore MVC中的路由(1)路由配置基础
.NetCore MVC中的路由(1)路由配置基础 0x00 路由在MVC中起到的作用 前段时间一直忙于别的事情,终于搞定了继续学习.NetCore.这次学习的主题是MVC中的路由.路由是所有MVC框 ...
- .NET基础拾遗(5)多线程开发基础
Index : (1)类型语法.内存管理和垃圾回收基础 (2)面向对象的实现和异常的处理基础 (3)字符串.集合与流 (4)委托.事件.反射与特性 (5)多线程开发基础 (6)ADO.NET与数据库开 ...
随机推荐
- ajax-php跨域请求
php: function __construct(){ // 指定允许其他域名访问 header("Access-Control-Allow-Origin: *"); heade ...
- 微信小程序之条件判断
前文: 今天踩了一下午的坑,但是确实很简单的问题. 我说一下需求:扫描商品的二维码,从而判断,同一个二维码不可多次扫描: 点击扫一扫 会在灰色区域展示 扫描的商品信息,比如商品名称,商品码等,但是我们 ...
- vue路由嵌套,对应展示的视图
- springboot ---> spring ioc 注册流程 源码解析 this.prepareContext 部分
现在都是在springboot 中 集成 spirng,那我们就从springboot 开始. 一:springboot 启动main 函数 public static void main(Strin ...
- Extjs4 修改combox中store的数据
{ xtype: "combo", fieldLabel: '选择模板', name: "TemplateType", fieldName: "Tem ...
- 六十:Flask.Cookie之flask设置cookie的有效域名
设置cookie有效域名cookie默认只能在主域名下使用,如果要在子域名下使用,则应该给set_cookie设置属性domain='.主域名',此时,此cookie在此主域名下的所有子域名均有效 f ...
- Python学习笔记:读取Excel的xlrd模块
一.安装xlrd 可以使用命令行安装也可使用pycharm进行安装 表示xlrd库已经安装成功,安装成功后,我们就可以导入使用了. 二.xlrd说明 (1.单元格常用的数据类型包括 0:empty(空 ...
- 关于docker安装、docker镜像、docker容器等
1.Ubuntu安装docker sudo apt install docker.io 注意以下命令需在root下进行 sudo -s 2.查看docker当前容器 docker ps -a 3.启动 ...
- fastjson反序列化LocalDateTime失败的问题java.time.format.DateTimeParseException: Text '2019-05-24 13:52:11' could not be parsed at index 10
本地java类 import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDateTime; ...
- httpClient 进行get请求
String url = baseUrl; logger.info("checkIfTheFolderIsExist"); CloseableHttpClient httpClie ...