You need to sign in to do that
Don't have an account?
Shruthi MN 32
LWC Help
I have written a code to calculate SI but each time I try to add calculate any value I am getting below error
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Below is the HTML code
<template>
<lightning-card title="Simple Interest Cal"></lightning-card>
<lightning-layout multiple-rows></lightning-layout>
<lightning-layout-item size= "12" padding = "around-medium" > </lightning-layout-item>
<lightning-input type="number" label = "Enter Principle" onchange= {principalChangeHandler}>
</lightning-input>
<lightning-layout-item size= "12" padding = "around-medium" > </lightning-layout-item>
<lightning-input type="numer" label = "Enter No Of Years" onchange= {timechangehandler}>
</lightning-input>
<lightning-layout-item size= "12" padding = "around-medium" > </lightning-layout-item>
<lightning-input type="number" label = "Enter Rate Of Interest" onchange= {ratechangehandler}>
</lightning-input>
<lightning-layout-item size= "12" padding = "around-medium" ></lightning-layout-item>
<lightning-button label= "Calculate SI" icon-position = "centre" onclick= {calculateSIHandler} >
</lightning-button>
<lightning-layout-item size= "12" padding = "around-medium" > </lightning-layout-item>
<lightning-formatted-text value= {currentoutput} ></lightning-formatted-text>
</template>
JS
import { LightningElement, track } from 'lwc';
export default class Simpleinterstcal extends LightningElement {
@track currentOutput;
principal;
rateofinterest;
noOfyears;
principalChangeHandler (event)
{
this.principal = parseInt(event.target.value,10);
}
timechangehandler (event)
{
this.noOfyears = parseInt(event.target.value,10);
}
ratechangehandler (event)
{
this.rateofinterest = parseInt(event.target.value,10);
}
calculateSIHandler()
{
this.currentOutput = 'Simple Interest is :' +parseFloat((this.principal*this.rateofinterest*this.noOfyears)/100);
}
}
XML
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>48.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>
Attached is the snip of the error
I have checked your code and its running in my org without any error, please check the API version of your org, might be that 48.0 is not currently supported