Skip to content

Commit

Permalink
fix: User permission content has been truncated (#738)
Browse files Browse the repository at this point in the history
  • Loading branch information
wzh425 authored Dec 13, 2024
1 parent 1c3a1cf commit c1076b4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
if (_shouldUpdateMasonry)
{
_shouldUpdateMasonry = false;
await InitOrUpdateMasonryAsync();
await InitMasonryAsync();
}
}

Expand All @@ -41,13 +41,13 @@ protected override async Task OnParametersSetAsync()
await base.OnParametersSetAsync();
}

protected virtual async Task InitOrUpdateMasonryAsync()
protected virtual async Task InitMasonryAsync()
{
if (Value is not null)
{
foreach (var category in Value.Children)
{
await JsRuntime.InvokeVoidAsync("MasaStackComponents.initOrUpdateMasonry", $".{idPrefix}_{category.Id}", ".app", 24);
await JsRuntime.InvokeVoidAsync("MasaStackComponents.initMasonry", $".{idPrefix}_{category.Id}", ".app", 24);
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions src/Masa.Stack.Components/wwwroot/js/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,20 @@ window.MasaStackComponents.getTimezoneOffset = function() {

let masonryInstances = {};

window.MasaStackComponents.initOrUpdateMasonry = (selector, itemSelector, gutter) => {
window.MasaStackComponents.initMasonry = (selector, itemSelector, gutter) => {
const elem = document.querySelector(selector);
if (!elem) return;

if (masonryInstances[selector]) {
masonryInstances[selector] = new Masonry(elem, {
itemSelector: itemSelector,
columnWidth: itemSelector,
percentPosition: true,
gutter: gutter
});

setTimeout(() => {
masonryInstances[selector].layout();
} else {
masonryInstances[selector] = new Masonry(elem, {
itemSelector: itemSelector,
columnWidth: itemSelector,
percentPosition: true,
gutter: gutter
});
}
}, 1000);
};

function debounce(fn, wait) {
Expand Down

0 comments on commit c1076b4

Please sign in to comment.