-1

im trying extends the paper-input component from Polymer 3 like documentation says but i cant. https://polymer-library.polymer-project.org/3.0/docs/devguide/dom-template#inherit

In the next example you can try using the snippet. The problem is the import of paper-input hasnt PaperInputElement export so i cant import. You must to see here : https://unpkg.com/@polymer/polymer/polymer-element.js?module

Could you help me?

<script type='module'>
  import 'https://unpkg.com/@polymer/paper-input@3.0.1/paper-input.js?module';
    import {PolymerElement, html} from 'https://unpkg.com/@polymer/polymer/polymer-element.js?module';

  class DmInput extends PaperInputElement {
      static get template() {
          return html`
              <style>

              </style>
              <p>hi</p>
              <p>${super.template}</p>
              `;
      }
  }

  window.customElements.define('dm-input', DmInput);


</script>
<dm-input></dm-input>
terribleWeb
  • 141
  • 2
  • 7
  • 1
    You can't just say that you can't extend the component; you have to describe the problem you're having. What errors do you see in the console? What is appearing on the page? What code have you written? In order to get help, you have to be more specific. – Michael Kucinski Feb 14 '19 at 16:32

1 Answers1

2

I believe you're attempting to import the wrong file here, Paper-input is just a ui component that uses the PaperInputBehavior. Try replacing PaperInputElement in this case with the behavior as all functions, properties and events that the input element uses come from it.

  class DmInput extends PaperInputBehavior {
      static get template() {
          return html`
              <style>

              </style>
              <p>hi</p>
              <p>${super.template}</p>
              `;
      }
  }