在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答
萌二代 回答
  1. 為啥你要寫 node 后端?現(xiàn)有的 Java 無(wú)法滿足需求么?
  2. webpack 基于 node 環(huán)境運(yùn)行,但它只是個(gè)打包工具,生產(chǎn)環(huán)境基本上用不到。這個(gè)都沒(méi)理解,我覺(jué)得你需要好好跟領(lǐng)導(dǎo)聊聊……
  3. node.js 的目標(biāo)是把 JS 帶到全平臺(tái)。對(duì)于前端開(kāi)發(fā)者來(lái)說(shuō),它帶來(lái)的第一個(gè)巨大利好,就是我們可以用它完善一整套前端工具體系,所以你可以看到很多類似 webpack 的工具。這并不影響用它跑服務(wù)。

data事件是flow模式才會(huì)觸發(fā)的,而事件機(jī)制是node內(nèi)部維護(hù)的,所以名稱也是內(nèi)部規(guī)定的。

墨沫 回答

https://github.com/chenyinkai...

可以參考一下,沒(méi)有辦法直接判斷是否下載了app

空痕 回答

這個(gè)是因?yàn)閟pring的動(dòng)態(tài)代理,把class去掉動(dòng)態(tài)代理那塊字符串,再轉(zhuǎn)成類就能獲取到注解了.

熟稔 回答

沒(méi)記錯(cuò)的話android P所有隱藏方法已經(jīng)不允許開(kāi)發(fā)者通過(guò)任何形式進(jìn)行調(diào)用了吧,反射都不行。

柚稚 回答

main 是個(gè)靜態(tài)方法啊,怎么引用一個(gè) 非 static 的屬性 UserService。

public class SpringMyBatisTest {
    
    @Autowired
    private UserService userService;
    
    public staic void main(String ... args) {
        new SpringMyBatisTest().test();
    }
    
    public void test() {
        User user = userService.getUserByUsername("abc");
        ...
    }
}
伐木累 回答

ref拿到實(shí)例,然后調(diào)用實(shí)例的blur方法試一下,或者用findDOMNode拿到Input的dom節(jié)點(diǎn)然后調(diào)用blur方法。

萌吟 回答

@藕絲空間 結(jié)果是出來(lái)了。

In [128]: sbq = db.session.query(User.email, User.username, func.count(Comment.author_id).label("c_nums
     ...: ")).filter(User.id==Comment.author_id).subquery()

In [129]: data = db.session.query(User.email, User.username, sbq.c.c_nums).order_by(sbq.c.c_nums.desc()
     ...: ).distinct().all()

In [130]: for d in data:
     ...:     print(d.email, d.username, d.c_nums)
     ...:     
(u'raymond@dabshots.org', u'shirley', 100L)
(u'cheryl@quaxo.net', u'rachel', 100L)
(u'debra@yoveo.net', u'carol', 100L)
(u'kathleen@kaymbo.com', u'nancy', 100L)
(u'melissa@youtags.org', u'amy', 100L)
(u'margaret@riffwire.net', u'kimberly', 100L)
...
...

但是沒(méi)有排序:

In [131]: for i in User.query.all():
     ...:     print i.email, i.username, i.comments.count()
     ...:     
raymond@dabshots.org shirley 2
margaret@riffwire.net kimberly 6
brenda@realbuzz.com ashley 1
lillian@devpulse.name julia 4
linda@babbleopia.biz mildred 3
helen@mycat.name douglas 4
kathleen@kaymbo.com nancy 1
teresa@zoombeat.name melissa 5
evelyn@skalith.com stephanie 6
...
...
鐧簞噯 回答

為什么要增大兩倍呢? weex打包到web平臺(tái)會(huì)自動(dòng)計(jì)算成對(duì)應(yīng)的寬度吧..

去網(wǎng)上找找插件,IE低版本不支持border-radius(包括其它CSS3屬性)

這類問(wèn)題直接去網(wǎng)上搜索比在這兒提問(wèn)好且快

貓小柒 回答

this.$route.query.參數(shù)名字

遺莣 回答

如何正確地在React中處理事件

參考官網(wǎng)

1、構(gòu)造器內(nèi)綁定this

class MyComponent extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            count: 0
        };
        this.handleClick = this.handleClick.bind(this);
    }

    handleClick() {
        this.setState({
            count: ++this.state.count
        });
    }

    render() {
        return (
        <div>
            <div>{this.state.count}</div>
            <button onClick={this.handleClick}>Click</button>
        </div>
        );
    }
}

這種方式的好處是每次render,不會(huì)重新創(chuàng)建一個(gè)回調(diào)函數(shù),沒(méi)有額外的性能損失。需要注意的是,使用這種方式要在構(gòu)造函數(shù)中為事件回調(diào)函數(shù)綁定this: this.handleClick = this.handleClick.bind(this),否則handleClick中的this是undefined。這是因?yàn)镋S6 語(yǔ)法的緣故,ES6 的 Class 構(gòu)造出來(lái)的對(duì)象上的方法默認(rèn)不綁定到 this 上,需要我們手動(dòng)綁定。

2、屬性初始化

使用ES7的 property initializers,代碼可以這樣寫:

class MyComponent extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            count: 0
        };
    }

    handleClick = () => {
        this.setState({
            count: ++this.state.count
        });
    }

    render() {
        return (
        <div>
            <div>{this.state.count}</div>
            <button onClick={this.handleClick}>Click</button>
        </div>
        );
    }
}

這種方式就不需要手動(dòng)綁定this了。但是你需要知道,這個(gè)特性還處于試驗(yàn)階段,默認(rèn)是不支持的。如果你是使用官方腳手架Create React App 創(chuàng)建的應(yīng)用,那么這個(gè)特性是默認(rèn)支持的。你也可以自行在項(xiàng)目中引入babel的transform-class-properties插件獲取這個(gè)特性支持。

3、箭頭函數(shù)

class MyComponent extends React.Component {
    render() {
        return (
        <button onClick={()=>{console.log('button clicked');}}>
            Click
        </button>
        );
    }
}

當(dāng)事件響應(yīng)邏輯比較復(fù)雜時(shí),如果再把所有的邏輯直接寫在onClick的大括號(hào)內(nèi),就會(huì)導(dǎo)致render函數(shù)變得臃腫,不容易直觀地看出組件render出的元素結(jié)構(gòu)。這時(shí),可以把邏輯封裝成組件的一個(gè)方法,然后在箭頭函數(shù)中調(diào)用這個(gè)方法。如下所示:

class MyComponent extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            count: 0
        };
    }
    handleClick() {
        this.setState({
            count: ++this.state.count
        });
    }
    render() {
        return (
        <div>
            <div>{this.state.number}</div>
            <button onClick={()=>{this.handleClick();}}>Click</button>
        </div>
        );
    }
}

這種方式最大的問(wèn)題是,每次render調(diào)用時(shí),都會(huì)重新創(chuàng)建一個(gè)事件的回調(diào)函數(shù),帶來(lái)額外的性能開(kāi)銷,當(dāng)組件的層級(jí)越低時(shí),這種開(kāi)銷就越大,因?yàn)槿魏我粋€(gè)上層組件的變化都可能會(huì)觸發(fā)這個(gè)組件的render方法。當(dāng)然,在大多數(shù)情況下,這點(diǎn)性能損失是可以不必在意的。這種方式也有一個(gè)好處,就是不需要考慮this的指向問(wèn)題,因?yàn)檫@種寫法保證箭頭函數(shù)中的this指向的總是當(dāng)前組件。

4、函數(shù)傳遞參數(shù)

事件的回調(diào)函數(shù)默認(rèn)是會(huì)被傳入一個(gè)事件對(duì)象Event作為參數(shù)的。如果我想傳入其他參數(shù)給回調(diào)函數(shù)應(yīng)該怎么辦呢?

使用第一種方式(構(gòu)造器內(nèi)綁定this)的話,可以把綁定this的操作延遲到render中,在綁定this的同時(shí),綁定額外的參數(shù):

// 代碼6
class MyComponent extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
        list: [1,2,3,4],
        current: 1
        };
    }

    handleClick(item) {
        this.setState({
            current: item
        });
    }

    render() {
        return (
        <ul>
            {this.state.list.map(
                (item)=>(
                <li className={this.state.current === item ? 'current':''} 
                onClick={this.handleClick.bind(this, item)}>{item}
                </li>
                )
            )}
        </ul>
        );
    }
}

使用第二種方式(屬性初始化),解決方案和第一種基本一致:

// 代碼7
class MyComponent extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            list: [1,2,3,4],
            current: 1
        };
    }

    handleClick = (item) =>  {
        this.setState({
            current: item
        });
    }

    render() {
        return (
        <ul>
            {this.state.list.map(
                (item)=>(
                <li className={this.state.current === item ? 'current':''} 
                onClick={this.handleClick.bind(undefined, item)}>{item}
                </li>
                )
            )}
        </ul>
        );
    }
}

不過(guò)這種方式就有點(diǎn)雞肋了,因?yàn)殡m然你不需要通過(guò)bind函數(shù)綁定this,但仍然要使用bind函數(shù)來(lái)綁定其他參數(shù)。

使用第三種方式(函數(shù)傳遞參數(shù))的話很簡(jiǎn)單,直接傳就可以了:

class MyComponent extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            list: [1,2,3,4],
            current: 1
        };
    }

    handleClick(item,event) {
        this.setState({
            current: item
        });
    }

    render() {
        return (
        <ul>
            {this.state.list.map(
                (item)=>(
                <li className={this.state.current === item ? 'current':''} 
                onClick={(event) => this.handleClick(item, event)}>{item}
                </li>
                )
            )}
        </ul>
        );
    }
}

關(guān)于事件響應(yīng)的回調(diào)函數(shù),還有一個(gè)地方需要注意。不管你在回調(diào)函數(shù)中有沒(méi)有顯式的聲明事件參數(shù)Event,React都會(huì)把事件Event作為參數(shù)傳遞給回調(diào)函數(shù),且參數(shù)Event的位置總是在其他自定義參數(shù)的后面。例如,在代碼6和代碼7中,handleClick的參數(shù)中雖然沒(méi)有聲明Event參數(shù),但你依然可以通過(guò)arguments[1]獲取到事件Event對(duì)象。

總結(jié)一下,三種綁定事件回調(diào)的方式,第一種有額外的性能損失;第二種需要手動(dòng)綁定this,代碼量增多;第三種用到了ES7的特性,目前并非默認(rèn)支持,需要Babel插件的支持,但是寫法最為簡(jiǎn)潔,也不需要手動(dòng)綁定this。推薦使用第二種和第三種方式。

葬憶 回答

1.首先如果是web請(qǐng)求 則可以簡(jiǎn)單開(kāi)啟php-fpm的慢查詢?nèi)罩尽7治龀瞿切┱?qǐng)求耗時(shí)過(guò)長(zhǎng)。。此方法可以初略的查到問(wèn)題所在

  1. 具體問(wèn)題分析。如果不依賴其他工具。則可以在一段代碼的開(kāi)始 記錄一個(gè)時(shí)間值最好用微秒。在覺(jué)得可能耗時(shí)的代碼后面用當(dāng)前微秒時(shí)間-之前記錄的微秒時(shí)間。。這其實(shí)有點(diǎn)類似于hooks.

3.依賴第三方工具?;蛘遬hp自帶的拓展。太多。。自行翻閱官方文檔。

毀了心 回答

list是表,map是記錄。那? list.getindex(?).get(K) 是不是你想要得?

傲嬌范 回答

你second.md里面第4行解析不了,應(yīng)該是你沒(méi)按格式寫

懶豬 回答

就存到頁(yè)面的一個(gè)地方,發(fā)ajax前先檢查一下,有就直接用,沒(méi)有就請(qǐng)求后端啊