Trying to pass a default value to an @api decorated property, somehow I get undefined variable, here is my code meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="mroConsumptionTable">
<apiVersion>46.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
</targets>
<targetConfigs>
<targetConfig targets="lightning__AppPage">
<property
name="type"
label="Per slot array"
type="String"
default="Single Rate"
required="true"
/>
</targetConfig>
</targetConfigs>
</LightningComponentBundle>
.js
@api set type(value){
console.log('in set type');
console.log(value);
this._type = value;
this.generateData();
}
get type(){
return this._type;
}
If you don't have a solution for this exact code, at least do share a working example of passing a property to a component