vue函数式组件
<template>改为<template functional> 即可
然后模板里使用到父组件参数的话,需在变量前面加上 props,如
<div>{{count}}</div> 改为 <div>{{props.count}}</div>
如果组件比较简单,只是展示数据的话,可以使用函数式组件,函数式组件没有生命周期(beforeCreated、beforeDestroy),可提升组件渲染性能
青云直上三千码
<template>改为<template functional> 即可
然后模板里使用到父组件参数的话,需在变量前面加上 props,如
<div>{{count}}</div> 改为 <div>{{props.count}}</div>
如果组件比较简单,只是展示数据的话,可以使用函数式组件,函数式组件没有生命周期(beforeCreated、beforeDestroy),可提升组件渲染性能