使用element-ui的常见问题
- 给组件绑定的事件为什么无法触发?
     在 Vue 2.0 中,为自定义组件绑定原生事件必须使用 .native 修饰符:
<my-component @click.native="handleClick">Click Me</my-component>
     从易用性的角度出发,我们对 Button 组件进行了处理,使它可以监听 click 事件:
<el-button @click="handleButtonClick">Click Me</el-button>
  但是对于其他组件,还是需要添加 .native 修饰符。
2.如何在 Table 组件的每一行添加操作该行数据的按钮?
使用 Scoped slot 即可:
<el-table-column label="操作">
  <template slot-scope="props">
    <el-button @click.native="showDetail(props.row)">查看详情</el-button>
  </template>
</el-table-column>
    参数 row 即为对应行的数据。
3.Tree 组件的 `render-content` 和 Table 组件的 `render-header` 怎么用?
     请阅读 Vue 文档 Render Function 的相关内容。注意,使用 JSX 来写 Render Function 的话,需要安装 babel-plugin-transform-vue-jsx,并参照其文档进行配置。
4.所有组件的任意属性都支持 `.sync` 修饰符吗?
     不是。对于支持 .sync 修饰符的属性,我们会在文档的 API 表格中注明。更多 .sync 的用法请查看 Vue 文档。
 
                     
                    
                 
                    
                
 
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号