dagger.js icon indicating copy to clipboard operation
dagger.js copied to clipboard

Is there anything about slot

Open wssnail opened this issue 3 years ago • 4 comments

Is there anything about the use of slots and the scope of slots

wssnail avatar Aug 04 '22 02:08 wssnail

Is there anything about the use of slots and the scope of slots

No. "slot" is used to insert custom content in some frameworks such as Vue/Svelte. In dagger.js, you need to put the dynamic content insides the fields of $scope, and render it with "$html" or "$text" directive of the child module. It should be a more general solution than slots.

The slot feature is supported for now, please refer to https://codepen.io/dagger8224/pen/bGKPNwN for the usage of it. Thanks.

dagger8224 avatar Aug 04 '22 02:08 dagger8224

Is there anything about the use of slots and the scope of slots

No. "slot" is used to insert custom content in some frameworks such as Vue/Svelte. In dagger.js, you need to put the dynamic content insides the fields of $scope, and render it with "$html" or "$text" directive of the child module. It should be a more general solution than slots.

Encourage component encapsulation?

If the component is encapsulated and for is encapsulated in the sub component, how can the display of a field in the sub component be modified in the parent component

wssnail avatar Aug 04 '22 03:08 wssnail

Is there anything about the use of slots and the scope of slots

No. "slot" is used to insert custom content in some frameworks such as Vue/Svelte. In dagger.js, you need to put the dynamic content insides the fields of $scope, and render it with "$html" or "$text" directive of the child module. It should be a more general solution than slots.

Encourage component encapsulation?

If the component is encapsulated and for is encapsulated in the sub component, how can the display of a field in the sub component be modified in the parent component

Please refer to this demo https://codepen.io/dagger8224/pen/vYdZKgx?editors=1100 to check out what happens if you modified the "message" field in the parent scope.

dagger8224 avatar Aug 04 '22 14:08 dagger8224

@wssnail Since the version 0.9.17 dagger.js supports slot feature already. You may reference to https://codepen.io/dagger8224/pen/bGKPNwN for the usage of slot, thanks for your suggestion.

dagger8224 avatar Oct 11 '23 08:10 dagger8224