polymer

Getting a node list by querySelectorAll()

徘徊边缘 提交于 2019-12-13 17:27:31
问题 Given the following sample code: import { LitElement, html, css } from 'lit-element'; class ItemsDisplay extends LitElement { static get styles() {...} static get properties {...} constructor () { super(); ... } render { return html` ${this.items.map((item, index, array) => html` <div class="name"> ... </div> `)} `; } } What is the appropriate way to select all nodes with class "name"? I have tried the following ways, but failed ; all times nodesList was undefined : Inside constructor : this

Polymer paper-dialog.open() is not defined

▼魔方 西西 提交于 2019-12-13 16:10:37
问题 I want to open a paper-dialog when click a button. I tried the following 2 approaches: on-click="dialog.open() I get this error: [my-app::_createEventHandler]: listener method dialog.open() not defined I don't understand why on-click="onCreateDialogTap": I put onCreateDialogTap event in myapp.js and try to access the dialog element by document.getElementById('dialog'); I know I cannot access it by this way because it is in local dom. But how do I access it since there are multiple layers of

Polymer 1.0 on-tap event's target is child

谁说我不能喝 提交于 2019-12-13 14:09:23
问题 I'm using on-tap to detect element clicks. <div id="parent" on-tap="myclickEvent"> <h1>Some text<h1> </div> But when i click on it, the target attribute in the fired event is the h1. How do I change to make the parent element be the target? 回答1: Try e.currentTarget . Don't expect it to be shown in console.log though as that browser function is asynchronous in Chrome (actually don't even bother logging event objects or objects inside events). But you can see it actually returns a div if you

Polymer Starter Kit - Pretty URLS on Nginx Server

蓝咒 提交于 2019-12-13 13:28:22
问题 the Polymer Starter Kit (PSK) contains instructions on using Pretty URLs when hosting on Firebase HERE I am attempting to do similar using Nginx Server, but cannot figure out the Location Block for page reloads. Using the sample data that comes with PSK, how would you configure "/users/sam", for example. 回答1: nginx config server { listen 80; server_name example.com; root /home/myuser/psk/dist; index index.html; location / { try_files $uri /index.html; } } Make sure to add a base url to your

How To Initialize Internationalization For A Polymer Element Before It Loads On Page

你说的曾经没有我的故事 提交于 2019-12-13 12:02:08
问题 I am using Dart to build a Polymer app. Since I am using Dart's internationalization capabilities within Polymer elements, I want to initialize internationalization messages before a Polymer element is created and display the appropriate messages for a given locale within the Polymer element. How can this be done? Has anyone successfully used Polymer with Internationalization? ps. I have followed this example to set up internationalization The following is the default generated Polymer app by

Polymer 2.0: What are the prerequisites? [closed]

删除回忆录丶 提交于 2019-12-13 09:02:11
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I'm relatively new to web development and have a basic understanding of JavaScript (loops, functions, objects) and recently I started learning Polymer 2.0 and I have been struggling with it for a while now. So I definitely need to brush up my skills. Please provide some resources that I should refer before

Why doesn't element catch event when using dispatchEvent from sibling polymer element?

☆樱花仙子☆ 提交于 2019-12-13 08:52:20
问题 I have the following polymer element in my UI which has two polymer elements, baseline-policy-create and baseline-policy-domain-ajax. <dom-module id="baseline-policies-tab"> <template> <style include="dfw-styles"> :host { display: block; } </style> <baseline-policy-create></baseline-policy-create> <baseline-policy-domain-ajax></baseline-policy-domain-ajax> </template> <script> class BaselinePoliciesTab extends Polymer.Element { static get is() { return 'baseline-policies-tab'; } static get

Polymer 1.x: How to filter iron-data-table?

巧了我就是萌 提交于 2019-12-13 08:27:49
问题 How do I add a filter attribute to <iron-data-table ? (Please post a plunk demo.) I forked this plunk. Then I tried to add a filter by adding the following line: <iron-data-table ... filter="['item.user.name.first.length', '< 5']"> Which broke the plunk. Here is the new (now broken) plunk. The documentation here describes the filter attribute as follows: filter An array containing path/filter value pairs that are used to filter the items. But it lacks an example of how to use it. How do I add

Polymer paper-dialog backdrop opacity?

☆樱花仙子☆ 提交于 2019-12-13 07:20:24
问题 I have a paper-dialog in my Polymer element. I want to make the backdrop opaque, right now it is semi-transparent. I would also like to change the color. Does anyone know how to do it. I have already tried this css in my custom element: <style is="custom-style"> --iron-overlay-backdrop-opacity:1; </style> <paper-dialog modal></paper-dialog> But it had no effect. I also tried <style is="custom-style"> :host { --iron-overlay-backdrop-opacity:1; } </style> <paper-dialog modal></paper-dialog> 回答1

Polymer index property of type object with another property

﹥>﹥吖頭↗ 提交于 2019-12-13 07:10:13
问题 I have a custom element, x-custom , that has a property, object , that is an Object. I have another property, name , that I want to use to index object , to put data from other custom elements under a specific property of object . Something like the following is the end goal: <other-custom-element data="{{object.{{name}}}}"></other-custom-element> ... name: { type: String, }, object: { type: Object, value: {} } So, in the example, if the value of name is "prop1", then the data from other