-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
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
feat: add mobx-strapi #209
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请把整个项目运行起来,看看控制台有没有任何网络接口报错、在后台添加的数据前台能不能显示出来。
models/Activity/Award.ts
Outdated
@@ -22,8 +23,8 @@ export interface AwardAssignment | |||
award: Award; | |||
} | |||
|
|||
export class AwardModel extends Stream<Award>(ListModel) { | |||
client = sessionStore.client; | |||
export class AwardModel extends Stream<Award>(StrapiListModel) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export class AwardModel extends Stream<Award>(StrapiListModel) { | |
export class AwardModel extends StrapiListModel<Award> { |
Strapi 有能定位到具体页数的分页参数,不需要 Stream
流式加载。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看不懂上面的两次修改
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看不懂上面的两次修改
以前是附加流式加载特性,需要用 mixin(混入)的写法,也就是单继承语言实现多继承。
但 Strapi 不需要流式加载,就直接继承基类即可。
@@ -22,8 +23,8 @@ export interface AwardAssignment | |||
award: Award; | |||
} | |||
|
|||
export class AwardModel extends Stream<Award>(ListModel) { | |||
client = sessionStore.client; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
此处不要改动,已经配置好登录验证机制的 API 客户端就是放在这个 store 上的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这我也看不懂了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这我也看不懂了
先说说你个人的理解。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
原来25 26 行代码是否要改动? 我已经迷糊了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
现在遇到 类型“AwardModel”上不存在属性“baseURI 的报错
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
此处不要改动,已经配置好登录验证机制的 API 客户端就是放在这个 store 上的。
关于 client 的问题是我昏头了,你改为 strapiClient
是对的,是我在迁移阶段还没把 client 移到 sessionStore
上。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
现在遇到 类型“AwardModel”上不存在属性“baseURI 的报错
参考:https://github.com/idea2app/MobX-RESTful/tree/main/wrapper/Strapi#modelarticlets
2f8a1ae
to
9b5f090
Compare
Checklist(清单):
Closes #204