You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// your answers
/**
* Implement a functional component :
* 1. Render the list elements (ul/li) with the list data
* 2. Change the list item text color to red when clicked.
*/
const ListComponent = (p, {emit} ) => {
const node = h('ul', p.list
.map((value: any, index: number) => h('li',
{
style:
{
color: p['active-index'] == index ? 'red' : 'green',
cursor: 'pointer'
},
onClick: () => {
emit('toggle', index)
}
},
value?.name
)));
return node;
}
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: