0

When I try executing Polymer element locally,I am using polymer 3 and my HTML structure is HTML5.

The counter-comp tag is added in my html file.

import {LitElement} from "@polymer/lit-element/lit-element.js"
class CounterComp extends LitElement{
constructor(){
    super()
}
static get properties(){
   return{
       color:String,
       background :String,
       fontweight: String
   }
}
_render({color,background,fontweight}){
    return html`
    <style>
    .title{
    background:$(background) ;
    color: $(color);
    font-weight:$(fontweight) ;
    padding: 15px 25px;
    }

</style>
<div class = "title">"This is in div tag with class title"</div>
    `;
    }
}
customElements.define("counter-comp",CounterComp);



<counter-comp color="green" background="blue" font-weight="355">
</counter-comp>

shady-render.ts:46 Uncaught TypeError: result.getTemplateElement is not a function at result (shady-render.ts:46) at render (shady-render.ts:130) at HTMLElement._applyRender (lit-element.ts:232) at HTMLElement._propertiesChanged (lit-element.ts:183) at HTMLElement._flushProperties (properties-changed.js?module:335) at HTMLElement._flushProperties (lit-element.ts:194) at HTMLElement.ready (properties-changed.js?module:179) at HTMLElement.ready (lit-element.ts:107) at HTMLElement._enableProperties (properties-changed.js?module:315) at HTMLElement.connectedCallback (properties-mixin.js?module:200)

I am getting the above Error please check and help to get this solved.

Thanks

Martin
  • 2,411
  • 11
  • 28
  • 30

1 Answers1

0

Instead of:

import {LitElement} from "@polymer/lit-element/lit-element.js"

use:

import {LitElement, html} from "@polymer/lit-element/lit-element.js"
Diego P
  • 1,728
  • 13
  • 28