我无法从第三方lib(fabricjs)的事件处理程序中弄清楚如何在我的聚合物元素上.set()
属性。例如:
<dom-module id="x-example">
<template>
<div id="objectTools" hidden$="{{objectToolsHidden}}">
<h1> object toolz!</h1>
</div>
<canvas id="c" width="400" height="400"></canvas>
</template>
<script>
Polymer({
is: 'x-example',
properties: {
canvas: Object,
objectToolsHidden: {
type: Boolean,
notify: true,
value: true
}
},
_onObjectSelected: function(e){
//hmm, this is the canvas elem... (???)
this.set('objectToolsHidden', false);
},
_onSelectionCleared: function(e){
this.set('objectToolsHidden', true);
},
ready: function(){
this.canvas = new fabric.Canvas(this.$.c);
var rect = new fabric.Rect({
top : 100,
left : 100,
width : 60,
height : 70,
fill : 'black'
});
this.canvas.add(rect);
this.canvas.on({
'object:selected': this._onObjectSelected,
'selection:cleared': this._onSelectionCleared
});
}
});
</script>
</dom-module>
...方法_onObjectSelected
被调用,但this.set()
未被定义为函数。如何从范围事件处理程序中访问我的元素属性?
还有一个jsfiddle:http://jsfiddle.net/ysoo8mjg/
答案 0 :(得分:0)
哦!!我可以在事件处理程序注册中使用job_id client_name shop_name job_text job_code
1 client1 shop1 job txt 0178923
2 client2 shop2 "job2 txt 67676
job2-txt
job2_txt"
3 client3 shop3 job3 txt 7878
gawk -F\\t 'BEGIN{OFS="\t";}{ print $1,$2,$3,$4,$5;}' downloads/download.csv > common.csv