在 Polymer 中刷新页面后,我试图在下拉设置中重新加载。下拉列表从 AJAX 调用中动态加载,并且一旦设置下拉列表,它就会保存在 localStorage 中。
<select id="customer" on-change="selectCustomer">
<option value="" selected disabled>Select Customer</option>
<template is="dom-repeat" items="[[customers]]" as="customer" index-as="index">
<option value="[[customer]]">[[customer]]</option>
</template>
</select>
...
selectCustomer() {
localStroage.setItem("customerName", this.$.customer.value = index;"
)
我努力了
setDropdown() {
// index generated in text matching for loop
this.$.customer.selectedIndex = index;
)
和
setDropdown() {
// customerName generated in text matching for loop
this.$.customer.value = customerName;
)