Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork245
Description
There are many UI plugins that require passing in a view as a property, in xml this is achieved the following way:
<nsDrawer:RadSideDrawerid="sideDrawer"> <nsDrawer:RadSideDrawer.drawerContent> <StackLayout><!-- etc--> </StackLayout> </nsDrawer:RadSideDrawer.drawerContent></nsDrawer:RadSideDrawer>
When registering custom UI elements that use the same approach, the problem is that in ns-vue
<RadSideDrawerid="sideDrawer"><StackLayout><!-- etc --></StackLayout></RadSideDrawer>
tries to append the StackLayout as a child element, and results in nothing displaying.
My initial idea is to add a custom directive that will handle this, using a similar syntax to the defaultv-bind:
,:
orv-on
,@
directives.
Naming things is hard, so please help me find a good name and syntax for the proposed directive.
The new syntax would look something like
<RadSideDrawerid="sideDrawer"><StackLayoutv-view:drawerContent><!-- etc --></StackLayout></RadSideDrawer>
And it would probably make sense to add a shorthand version as well
<RadSideDrawerid="sideDrawer"><StackLayout~drawerContent><!-- etc --></StackLayout></RadSideDrawer>
Leave your suggestion as a comment to what the name of the directive should be!
My initial idea isv-view:parentPropName
,~parentPropName
for the shorthand version.
Checklist
- Add
v-view
directive and~
as the alias - Document usage in docs
- Decide if
v-view
is the right name for the directive. - Add
.array
modifier - Add array mode shorthand alias
Allow setting a parent array property
So looks like we need to allow multiple children to be added to the parent's prop using an array. Either extend the module to detect arrays (this will likely break in many cases), or create a dedicated directive for setting the array.
Possible short syntax:~~
,~[]
,~.array
etc (comment below if you have an idea)
Example:
<Parent> <Child ~parentProp.array /> <Child ~parentProp.array /> <Child ~parentProp.array /></Parent>
The long syntax would use a directive modifier:v-view:prop.array
.