-
Notifications
You must be signed in to change notification settings - Fork 27
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
单个view-model如何显示两列表? #62
Comments
不行。你可以用两个ViewModel对应到同一个Model上。 |
返回值为 RET_ITEMS_CHANGED 仅表示 ViewModel 自身的项目数量发生变化。如果v-for绑定对象为ViewModel内的一个对象,有两种方式通知变化: |
|
可以参考demo35的实现。如果方便的话,可以发一个可以重现的简单C实例看看。 |
完善了demo13,添加了显示两列表的示例,可以参考 |
好的,我再看看,之前可能有东西没搞对。 |
还是有问题:渲染 const Size = struct {
@"#size": u32 = 0,
pub const Object = object.Object(Size, .{});
pub fn init(_: *Size) void {}
pub fn deinit(_: *Size) void {}
pub fn set(obj: *awtk.Object, size: usize) !void {
const size_obj = Object.cast(obj) orelse return object.Error.Mismatch;
const s: u32 = @intCast(size);
if (size_obj.model.@"#size" != s) {
size_obj.model.@"#size" = s;
awtk.notify(obj, c.EVT_ITEMS_CHANGED);
}
}
}; 详见这里 |
两个列表相互关联,所以让单个view-model显示两列表。我按如下实现了view-model,初始化时两个表示的内容显示正确,但列表内容修改后,列表在显示上没有更新。什么问题?
The text was updated successfully, but these errors were encountered: