0

Подскажите пожалуйста как вывести данные из бд в lit-element. Создал запрос к бд, выглядит так

const database = firebase.database();

const ref = database.ref('stiralki');
ref.once('value', function(snapshot) {
const stiralki = snapshot.val()
console.log(stiralki);
});

Дальше пытаюсь принять данные в lit-element, вот код

import { LitElement, html } from 'lit-element';

import './datab.js';

class MyData extends LitElement {
  static get properties() {
    return {
      // This is the data from the store.
      _title: { type: String },
      _description: { type: String }
    };
  }

  constructor() {
  super();
  this._title = 'getElementById().innerHTML = stiralki.title;';
  this._description = 'getElementById().innerHTML = stiralki.description';
  }

  render(){

    return html`
      <div>
        <p>A paragraph</p>
        <p id="title">${this._title}</p>
        <p id="description">${this._description}</p>
      </div>
    `;
  }
}
customElements.define('my-data', MyData);

Вот структура БД введите сюда описание изображения

Насколько я понимаю, что не верно, а точнее вообще неправильно записываю в constructor... Помогите новичку разобраться в выводе данных из бд.) Заранее спасибо!

1 ответ 1

0

Нашёл ответ на свой вопрос здесь https://github.com/Polymer/pwa-starter-kit/issues/196

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.