Closed EdCharbeneau closed 5 years ago
Taking it a bit further, what about being able to specify what you want, so.
codeinit tab+tab...
@code {
protected override async Task OnInitializeAsync()
{
// initialize code here
}
}
codeparam tab+tab...
@code {
[Parameter] public string YourPropHere { get; set; }
}
Note: I just realized that code
is reserved for HTML <code>
, so the b
prefix is needed.
Thinking the Parameter should be on all the time. How often do components not have some sort of IO. These have been added to an experimental branch. https://github.com/EdCharbeneau/BlazorProSnippets/tree/code-block-preview
bcode tab+tab...
@code {
[Parameter] public string YourPropHere { get; set; }
protected override async Task OnInitializeAsync()
{
// initialize code here
}
}
Lifecycle methods could be added through a similar snippet.
bcodelm tab+tab...
@code {
[Parameter] public Object MyObject { get; set; }
protected override async Task OnInitializedAsync()
{
// execute code to initialize the component
}
protected override async Task OnAfterRenderAsync()
{
// when values are assigned to properties
// fires after initialize and executes each render
}
protected override async Task OnParametersSetAsync()
{
// Use this stage to perform additional initialization
// steps using the rendered content,
// such as activating third-party JavaScript libraries
// that operate on the rendered DOM elements.
}
}
Looks good!
Thanks @chrissainty
Added to commit: eaaa84be2d7e959ad5dc2cdb299c67fe6c75c9a5
Chris Sainty started an idea of having a
@code
snippet. What would be the most useful output?Here's an idea I'd love to hear feedback on.
code tab+tab gives you...
or some variation of this. Maybe include all lifecycle methods, but commented out?