我想输出我在属性中保存的值。
这是一个简单的demo-element.html
。我只想显示标题。
但是 {{title}}
和 {{this.title}}
都不起作用。
<dom-module id="demo-element">
<template>
<style>
:host {
display: block;
}
</style>
<h1>'title' in properties not showing</h1>
<h2>{{this.title}}</h2>
</template>
<script>
Polymer({
is: 'demo-element',
properties: {
title: 'This is a regular Demo Title'
}
});
</script>
</dom-module>
如何在屏幕上输出我的属性?
我正在寻找 vue 的 {{ $data | 等价物json }}
最佳答案
this
在数据绑定(bind)时隐含。所以这个
<h2>{{this.title}}</h2>
变成这样
<h2>{{title}}</h2>
关于javascript - Polymer JS 简单数据绑定(bind)。如何在屏幕上输出属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33534451/