let component = null// if 语句
if (true) {
component = (
<div></div>
);
} else {
component = (
<div></div>
);
}
var ul = (
<ul>
{component}
</ul>
);
// map 语句
var coms = limit.map(i => {
return {
<li>
{ul}
</li>
};
})
// 属性
<li onClick={() => console.log()}>
// 自定义指令
let directives = [{name: 'prod-img', value: params.row.skn, modifiers: {skn: true}} ];
return (
<div>
<img {...{directives}}></img> // 属性展开
</div>
);
// 自定义过滤器
不建议使用,直接当函数使用
foo(something)
// methods
this.foo()
// model
<i-input
value={params.row.factoryCode}
placeholder='请输入...'
onInput={val => (params.row.factoryCode = val)}
style={{width: '100%'}}>
</i-input>
// 自定义事件
return (
<Operator
category-id={this.categoryId} // prop绑定
product={params.row} // prop 绑定
onChange={this.onChangeStatus}> // event 绑定
</Operator>
);
//三元运算
<div>
<h1>{i == 1 ? 'True!' : 'False'}</h1>
</div
// 注释
<div>
<h1>菜鸟教程</h1>
{/*注释...*/}
</div>
// html
<div>{{_html: '<h1>Hello World!!</h1>'}}</div>
// h函数写法
return h('Input', {
props: {
value: params.row.buyingNums
},
on: {
input: val => {
params.row.buyingNums = val;
},
'on-blur': () => {
this.update(params);
}
}
});
// 所有的事件监听必须以on开头,然后字母大写
// template
<input @on-change='click'>
// jsx
<input onOn-change={() => this.click()}></input>
export default {
name:'Test',
components:{
},
render(h){
return <div>
test
</div>
},
data () {
return {
}
}
}
babel-plugin-syntax-jsx\ babel-plugin-transform-vue-jsx\ babel-helper-vue-jsx-merge-props\
{ "presets": ["es2015"], "plugins": ["transform-vue-jsx"]
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有