Skip to content

[New Feature]是不是可以增加一个即用即创建的功能 #24

@SoonIter

Description

@SoonIter

Pinia在这方面的处理是,只有 需要使用model的组件 mount时,才会创建对应的model,onInit才会触发。
如果使用较多的model,在根部一开始就创建,直接占用了较高的内存。
假设有10个Model,现在App一启动,10个onInit同时都会触发。

即用即创建,由于用户视口有限,同时在线的model的数量是很少的。

我的想法是getModel(userModel).state.name,可以替代userModel.state.name
在getModel、useModel 时,同步创建对应的store。

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions