1
import {LightningElement, api} from 'lwc';

const TILE_WRAPPER_SELECTED_CLASS = 'tile-wrapper selected';

const TILE_WRAPPER_UNSELECTED_CLASS = 'tile-wrapper';

export default class BoatTile extends LightningElement { @api boat;

@api selectedBoatId;

get backgroundStyle () { return background-image:url(${this.boat.Picture__c}); }

get tileClass () { return this.selectedBoatId == this.boat.Id ? TILE_WRAPPER_SELECTED_CLASS : TILE_WRAPPER_UNSELECTED_CLASS; }

selectBoat () { this.selectedBoatId = !this.selectedBoatId;

const boatselect = new CustomEvent ('boatselect', {
  detail: {boatId: this.boat.Id},
});

this.dispatchEvent (boatselect);

} }

FSGeoff
  • 11
  • 2

1 Answers1

0

@FSGeoff You probably need to add one or more targets in the .xml file, e.g. <targets> <target>lightning__xxx</target> <target>lightning__yyy</target> <target>lightning__zzz</target> </targets>