首页 技术 正文
技术 2022年11月16日
0 收藏 689 点赞 4,394 浏览 2008 个字

监控 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 /_pageappend 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')
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,000
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,512
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,358
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,141
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,771
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,849