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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

TypeError: ClientAB.ClientAB is not a function

TypeError: ClientAB.ClientAB is not a function

蝴蝶刀刀 2019-02-26 13:15:36
import React from 'react';import CoffeeScript from '../../../utils/coffeeScript01'class Basic extends React.Component {    constructor() {        super();        this.state = {            data: ''        }    }    componentDidMount(){        // 在初始 render 之后才執(zhí)行        var ClientAB = (function() {            var now;            function ClientAB(ws) {                this.ws = ws;                this.ws.binaryType = "arraybuffer";                this.counter = 0;                this.connected = false;                this.heartbeat = {                    outgoing: 10000,                    incoming: 10000                };                this.maxWebSocketFrameSize = 16 * 1024;                this.subscriptions = {};                this.partialData = '';            }            ClientAB.prototype.debug = function(message) {                var _ref;                return typeof window !== "undefined" && window !== null ? (_ref = window.console) != null ? _ref.log(message) : void 0 : void 0;            };            return ClientAB;        })();        ClientAB.ClientAB('aa').debug('提示錯誤消息')    }    render() {        console.log('==============taskNames==============')        console.log(this.state.taskNames)        const taskNames = this.state.taskNames;        var divStyle = {        }        return (            <div id style={divStyle} className='data-line'>                {taskNames}            </div>        )    }}export default Basic;
查看完整描述

3 回答

?
慕萊塢森

TA貢獻1810條經(jīng)驗 獲得超4個贊

var clientAB = new ClientAB('aa');

clientAB.debug('提示錯誤消息');

//or

ClientAB('aa').debug('提示錯誤消息')//注意構(gòu)造函數(shù)不帶參報錯,因為空參構(gòu)造函數(shù)級別低


查看完整回答
反對 回復(fù) 2019-03-14
?
慕妹3146593

TA貢獻1820條經(jīng)驗 獲得超9個贊

直接ClientAB().debug()

var ClientAB = (function(){...return ClientAB;})(); // 這其實是原始的類的聲明方式

那么ClientAB就是function ClientAB(ws){...}這個方法本身啊,直接調(diào)用,prototype上有debug方法

或者像二樓那樣new出來


查看完整回答
反對 回復(fù) 2019-03-14
?
月關(guān)寶盒

TA貢獻1772條經(jīng)驗 獲得超5個贊

這樣寫,還不如不要使用react。多費勁呀~


查看完整回答
反對 回復(fù) 2019-03-14
  • 3 回答
  • 0 關(guān)注
  • 749 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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