将布尔值从Polymer 2.x组件传递到点亮的组件?

问题描述

我试图将布尔值从polymer 2.x中编写的组件传递给组件(以lit-element编写)

类似这样的东西:

组件(聚合物2):

<test-lit my-attr=[[_checkValue(val)]]></test-lit>

_checkValue(val) {
  return val ? true : false;
}

照明组件:

class TestLit extends LitElement 
{
    static get properties() {
      myAttr: { type: Boolean,attribute: "my-attr",value: false }
    }

    render() {
      return html`${this.myAttr ? "Passed" : "Failed"}`;
    }
}

customElements.define('test-lit',TestLit);

问题:在上面的示例中,我试图将点灯组件的属性绑定为test-lit中的属性

我能以某种方式将polymer组件中的布尔值传递给light而不绑定test-lit中的属性吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)