We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Learn more about funding links in repositories.
Report abuse
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[vue] 你了解什么是函数式组件吗?
The text was updated successfully, but these errors were encountered:
函数式组件:
需要提供一个render方法, 接受一个参数(createElement函数), 方法内根据业务逻辑,通过createElement创建vnodes,最后return vnodes
createElement函数, 三个参数, 第一个参数是html标签或自定义组件,第二个参数一个obj(包含props, on...等等), 第三个参数children(通过createElement构建, 或者字符串)
Sorry, something went wrong.
https://juejin.im/post/5b38f4bef265da59bc2cb921
我的理解是:将一个组件的功能抽离出来,只管理状态和数据,这样就可以应对一些功能相似但是布局不同的业务需求。 比如一个tagList组件,它的核心功能就是维护一个列表,并且可以添加和删除,把这个核心功能抽离出来作为一个函数式组件,只管理这个列表的添加、删除状态,再暴露一些其他可能用到的数据(如详情列表),然后通过二次封装来实现具体样式。 参考:函数式组件在Vue.js中的运用
tagList
functional
No branches or pull requests
[vue] 你了解什么是函数式组件吗?
The text was updated successfully, but these errors were encountered: