javascript - 根据 Polymer 3.0 使用 JS/HTML 文件加载元素的布局
问题描述
HTML 文件:=== === === === === ===
<script type = "module">
import { PolymerElement } from '@polymer/polymer/polymer-element.js';
class QyInsights extends PolymerElement {
static get template() {
// Template getter must return an instance of HTMLTemplateElement.
// The html helper function makes this easy.
return html `
<style include="qy-app-theme shared-styles granite-bootstrap iron-flex iron-flex-alignment">
:host{
}
</style>
<qy-insights>
Elements content need to load in main template.
<qy-insights>
`;
}
static get is() {
return 'qy-insights';
}
static get properties() {
return {
productsWithPotential: String,
}
}
connectedCallback() {
super.connectedCallback();
this._onInit();
}
ready() {
super.ready();
}
attached() {
lang.translate(this);
//tour.start();
document.title = lang.get('insights') + ' | Qymatix';
}
_onInit() {
lang.translate(this);
//tour.start();
document.title = lang.get('insights') + ' | Qymatix';
}
_getLabel(key) {
return lang.get(key);
}
}
customElements.define(QyInsights.is, QyInsights);
</script>
JS文件:=== === === === === ===
import {
PolymerElement,
html
} from '@polymer/polymer/polymer-element.js';
import {} from '@polymer/polymer/lib/legacy/polymer.dom.js';
class QyInsights extends PolymerElement {
static get template() {
// Template getter must return an instance of HTMLTemplateElement.
// The html helper function makes this easy.
return html `
<style include="qy-app-theme shared-styles granite-bootstrap iron-flex iron-flex-alignment">
:host{
}
</style>
<qy-insights>
Elements content need to load in main template.
<qy-insights>
`;
}
static get is() {
return 'qy-insights';
}
static get properties() {
return {
productsWithPotential: String,
}
}
connectedCallback() {
super.connectedCallback();
this._onInit();
}
ready() {
super.ready();
}
attached() {
lang.translate(this);
//tour.start();
document.title = lang.get('insights') + ' | Qymatix';
}
_onInit() {
lang.translate(this);
//tour.start();
document.title = lang.get('insights') + ' | Qymatix';
}
_getLabel(key) {
return lang.get(key);
}
}
customElements.define(QyInsights.is, QyInsights);
解决方案
推荐阅读
- java - 泽西岛,如何以 json 格式创建对象列表的发布请求?
- qt - QPushButton 导出到 QML
- macos - Docker 容器 - 如何在运行容器之前检查目标结构?
- codeigniter - 使用 .htaccess 删除 url 中的 index.php 但失败
- ios - 如何在 MapKit 中绘制带外边框的叠加层?
- matplotlib - 在networkx .module'matplotlib.pyplot'中绘制图形时出错,没有属性'ishold'
- python - django 2.2“用户定义聚合的'finalize'方法引发错误”
- ruby-on-rails - Ruby .round() 函数对值进行四舍五入,但仅将原始值存储在数据库中
- pandas - 如何从 pandas 数据框中找到与数组相同的行索引?
- javascript - Parse JS:提供了 Master Key,但 Parse 似乎无法识别它