1 回答

TA貢獻(xiàn)1829條經(jīng)驗(yàn) 獲得超9個(gè)贊
您的myModel
函數(shù)不一定需要返回任何內(nèi)容,它還可以通過this
.?makerjs.exporter.toSVG
正在尋找您在下面一行中公開的實(shí)例的paths
屬性。new myModel()
this.paths?=?pathObject;
在上面的行中,您正在paths
當(dāng)前實(shí)例上創(chuàng)建一個(gè)屬性,其中當(dāng)前實(shí)例是通過 訪問的this
。正如您在下面的代碼片段中看到的,我可以paths
使用m.paths
.
function myModel() {
?var line = {?
? ?type: 'line',?
? ?origin: [0, 0],?
? ?end: [50, 50]?
? };
?var circle = {?
? ?type: 'circle',?
? ?origin: [0, 0],
? ?radius: 50
? };
?var pathObject = { myLine: line, myCircle: circle };
//set properties using the "this" keyword ***here I dont' understand
?this.paths = pathObject;
}
let m = new myModel();
console.log(m.paths)
- 1 回答
- 0 關(guān)注
- 132 瀏覽
添加回答
舉報(bào)