I am rendering a Blazor component in a HTML document from JavaScript. It is working 100% but once my Blazor component has rendered, I can not update one of the component parameters. This example is in the.Net 6 RC1 spec. I would appreciate some help on two way binding of a parameter.
Code in my HTML file:
<script>
async function loadComponent() {
let containerElement = document.getElementById('my-counter');
await Blazor.rootComponents.add(
containerElement,
'counter', { currentCount: count });
};
</script>
I want to update "Count" after the component is rendered.
See here for the Microsoft.Net6 RC1 notes.
I have only an idea for one way (blazor->JS).
You could define a JS-function that increment the counter and call it with blazor.
Did you define in startup.cs? Do you use the server or wasm host model? Do you want to update it from js or from the razor component?
After component is rendered like this it should be responsive
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.