i have a problem to call a uikit notification and set the position and timeout
uikit original:
#1 UIkit.notification('My message');
#2 UIkit.notification('My message', status);
#3 UIkit.notification('My message', { /* options */ });
#4 UIkit.notification({ /* options */ });
this works but there is no position or timeout
_IJSRuntime.InvokeVoidAsync("UIkit.notification", new[] { label, color});
code:
private IJSRuntime _IJSRuntime { get; set; }
public UIKit(IJSRuntime iJSRuntime)
{
_IJSRuntime = iJSRuntime;
}
public void Notification(string label, string color, string position = "bottom-right")
{
_IJSRuntime.InvokeVoidAsync("UIkit.notification", "{" + $"message:'{label}', status:'{color}', timeout:5000, pos:'{position}'" + "}" );
}
can someone help me out?
Not my favorite but my solution is:
Create a new js file "UiKitCustom.js"
function Notification(label, color, timeout, position) {
UIkit.notification({
message: label,
status: color,
timeout: timeout,
pos: position
});
}
and call this function
await _IJSRuntime.InvokeVoidAsync("Notification", new[] { $"{label}", $"{color}", $"{timeoute}", $"{position}" });
But i hope someone give me a better way :)