I want to set a defalt value in the constructor depends on other value.
Here is the template where the type values are:
class SelectOption extends LitElement {
static get properties() {
return {
type: {type: Array}
};
}
constructor() {
super();
this.type = ['1', '2'];
}
This is more or less what I want:
import { LitElement, html } from 'lit-element';
class SelectCounter extends LitElement {
static get properties() {
return {
type: {type: Array},
numPassengers: {type: Number},
};
}
constructor() {
super();
this.numPassengers = {
if (this.type === '1') {
this.numPassengers = 1;
} else {
this.numPassengers = 0;
}
}
}
}