第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

關(guān)于getInitialState的寫法

如果寫成:

????getInitialState() {

? ? return {

? ? imgsArrangeArr:[]

????}

????}

就會彈出這個警告:getInitialState was defined on AppComponent, a plain JavaScript class. This is only supported for classes created using React.createClass. Did you mean to define a state property instead?

如果寫成getInitialState: function() {}的形式 ?就會提示在這個地方有語法錯誤。。。

正在回答

3 回答

constructor(props)?{
	?	super(props);

		//?存儲排布的可取范圍
		this.Constant?=?{
			//?中心圖片的位置點
			centerPos:?{
				left:?0,
				right:?0
			},
			//?水平方向的取值范圍
			hPosRange:?{
				leftSecX:?[0,?0],
				rightSecX:?[0,?0],
				y:?[0,0]
			},
			//?垂直方向的取值范圍
			vPosRange:?{
				x:?[0,?0],
				topY:?[0,?0]
			}
		};

		this.state?=?{
			imgsArrangeArr:?[
				//?pos:?{
				//?	left:?'0',
				//?	right:?'0'
				//?}
			]
		};
	}


0 回復(fù) 有任何疑惑可以回復(fù)我~
constructor(props)?{
	?	super(props);

		//?存儲排布的可取范圍
		this.Constant?=?{
			//?中心圖片的位置點
			centerPos:?{
				left:?0,
				right:?0
			},
			//?水平方向的取值范圍
			hPosRange:?{
				leftSecX:?[0,?0],
				rightSecX:?[0,?0],
				y:?[0,0]
			},
			//?垂直方向的取值范圍
			vPosRange:?{
				x:?[0,?0],
				topY:?[0,?0]
			}
		};

		this.state?=?{
			imgsArrangeArr:?[
				//?pos:?{
				//?	left:?'0',
				//?	right:?'0'
				//?}
			]
		};
	}


0 回復(fù) 有任何疑惑可以回復(fù)我~

?getInitialState() {

? ? return {

? ? imgsArrangeArr:[]

????};

????}

//少寫了個;

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消
React實戰(zhàn)--打造畫廊應(yīng)用(上)
  • 參與學(xué)習(xí)       57293    人
  • 解答問題       283    個

顛覆式前端UI開發(fā)框架 React,打造圖片畫廊實踐案講解

進入課程

關(guān)于getInitialState的寫法

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號