首页 > Web开发 > 详细

vue中使用jsx语法 render渲染函数

时间:2020-07-08 17:42:48      阅读:265      评论:0      收藏:0      [点我收藏+]
 
渲染函数不可以template同时使用,render于data,methods等同级
 
非必要需求不建议在vue中使用 jsx 语法
例子:
<script>
export default {
    components:{
      
    },
    name: ‘children‘,
    mounted(){
        
       
    },
   
 render(){
            return(
                <div>
                    <el-button onClick={()=>{this.c()}}>我是jsx语法</el-button>
                    {
                        this.arr.map((item,index)=>{
                            return  <div>{item}</div>
                        })
                    }
                </div>
            )
    },
    methods:{
        c(){
            console.log(‘1‘)
        }
    },
    
  
}
</script>

<style scoped>

</style>

vue中使用jsx语法 render渲染函数

原文:https://www.cnblogs.com/suntongxue/p/13267862.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!