JSX
插值
<span>Message: {this.messsage}</span>
<div domPropsInnerHTML={this.dangerHtml}/>
<el-input v-model={this.vm.name} />
样式
<div class="btn btn-default" style="font-size: 12px;">Button</div>
<div class={`btn btn-${this.isDefault ? 'default' : ''}`}></div>
<div class={{'btn-default': this.isDefault, 'btn-primary': this.isPrimary}}></div>
<div style={{color: 'red', fontSize: '14px'}}></div>
遍历
//-没有v-指令,除了v-show
{/* 类似于v-if */}
{this.withTitle && <Title />}
{/* 类似于v-if 加 v-else */}
{this.isSubTitle ? <SubTitle /> : <Title />}
{/* 类似于v-for */}
{this.options.map(option => {
<div>{option.title}</div>
})}
事件绑定
<el-buton onClick={this.handleClick}>Click me</el-buton>
<el-button nativeOnClick={this.handleClick}>Native click</el-button>
<el-button onClick={e => this.handleClick(this.id)}>Click and pass data</el-button>