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

鍍金池/ 問答
純妹 回答

一 父子組件傳值,props

1.父組件
onChange(用來接收子組件傳的值){

}

<Child_1 name="張三" age="25" onChange={this.onChange.bind(this)} />

2.子組件

this.props.onChange(傳遞的值)

二 redux

關(guān)于redux使用 可以看看我的個(gè)人博客 http://www.liuweibo.cn/blog

臭榴蓮 回答

需要在文件一開始或者塊級(jí)作用域中設(shè)置"use strict", 例如:

function test(){
    "use strict";
    //some other code
    let o = {
        'M+': date.getMonth() + 1,
        'd+': date.getDate(),
        'h+': date.getHours(),
        'm+': date.getMinutes(),
        's+': date.getSeconds()
    };
} 
孤客 回答

babel-polyfill一般都是放在最上面的.. 因?yàn)榭赡苣阌玫牟寮蛘吣承┛蚣苡昧诵绿匦缘腁PI,放在最開頭能保證先進(jìn)行polyfill

清夢(mèng) 回答

這并不影響使用吧。只是個(gè)warning。

另外有:https://stackoverflow.com/que...
大意是,請(qǐng)使用未壓縮版本。

孤毒 回答

script放在body結(jié)束標(biāo)簽的前面

嫑吢丕 回答

一個(gè)不精分的做法是針對(duì)蜘蛛單獨(dú)寫頁面, 讓蜘蛛看到的和人看到的內(nèi)容不一樣,但url一樣.

你的瞳 回答

你看看這個(gè)行不行, 大概也就這樣思路.

/**
 * 紅包分配算法
 *
 * example
 *      $coupon = new Coupon(200, 5);
 *      $res = $coupon->handle();
 *      print_r($res);
 *
 * @author Flc <2018-04-06 20:09:53>
 * @see http://flc.ren | http://flc.io | https://github.com/flc1125
 */
class Coupon
{
    /**
     * 紅包金額
     *
     * @var float
     */
    protected $amount;

    /**
     * 紅包個(gè)數(shù)
     *
     * @var int
     */
    protected $num;

    /**
     * 領(lǐng)取的紅包最小金額
     *
     * @var float
     */
    protected $coupon_min;

    /**
     * 紅包分配結(jié)果
     *
     * @var array
     */
    protected $items = [];

    /**
     * 初始化
     *
     * @param float $amount     紅包金額(單位:元)最多保留2位小數(shù)
     * @param int   $num        紅包個(gè)數(shù)
     * @param float $coupon_min 每個(gè)至少領(lǐng)取的紅包金額
     */
    public function __construct($amount, $num = 1, $coupon_min = 0.01)
    {
        $this->amount = $amount;
        $this->num = $num;
        $this->coupon_min = $coupon_min;
    }

    /**
     * 處理返回
     *
     * @return array
     */
    public function handle()
    {
        // A. 驗(yàn)證
        if ($this->amount < $validAmount = $this->coupon_min * $this->num) {
            throw new Exception('紅包總金額必須≥'.$validAmount.'元');
        }

        // B. 分配紅包
        $this->apportion();

        return [
            'items' => $this->items,
        ];
    }

    /**
     * 分配紅包
     */
    protected function apportion()
    {
        $num = $this->num;  // 剩余可分配的紅包個(gè)數(shù)
        $amount = $this->amount;  //剩余可領(lǐng)取的紅包金額

        while ($num >= 1) {
            // 剩余一個(gè)的時(shí)候,直接取剩余紅包
            if ($num == 1) {
                $coupon_amount = $this->decimal_number($amount);
            } else {
                $avg_amount = $this->decimal_number($amount / $num);  // 剩余的紅包的平均金額

                $coupon_amount = $this->decimal_number(
                    $this->calcCouponAmount($avg_amount, $amount, $num)
                );
            }

            $this->items[] = $coupon_amount; // 追加分配

            $amount -= $coupon_amount;
            --$num;
        }

        shuffle($this->items);  //隨機(jī)打亂
    }

    /**
     * 計(jì)算分配的紅包金額
     *
     * @param float $avg_amount 每次計(jì)算的平均金額
     * @param float $amount     剩余可領(lǐng)取金額
     * @param int   $num        剩余可領(lǐng)取的紅包個(gè)數(shù)
     *
     * @return float
     */
    protected function calcCouponAmount($avg_amount, $amount, $num)
    {
        // 如果平均金額小于等于最低金額,則直接返回最低金額
        if ($avg_amount <= $this->coupon_min) {
            return $this->coupon_min;
        }

        // 浮動(dòng)計(jì)算
        $coupon_amount = $this->decimal_number($avg_amount * (1 + $this->apportionRandRatio()));

        // 如果低于最低金額或超過可領(lǐng)取的最大金額,則重新獲取
        if ($coupon_amount < $this->coupon_min
            || $coupon_amount > $this->calcCouponAmountMax($amount, $num)
        ) {
            return $this->calcCouponAmount($avg_amount, $amount, $num);
        }

        return $coupon_amount;
    }

    /**
     * 計(jì)算分配的紅包金額-可領(lǐng)取的最大金額
     *
     * @param float $amount
     * @param int   $num
     */
    protected function calcCouponAmountMax($amount, $num)
    {
        return $this->coupon_min + $amount - $num * $this->coupon_min;
    }

    /**
     * 紅包金額浮動(dòng)比例
     */
    protected function apportionRandRatio()
    {
        // 60%機(jī)率獲取剩余平均值的大幅度紅包(可能正數(shù)、可能負(fù)數(shù))
        if (rand(1, 100) <= 60) {
            return rand(-70, 70) / 100; // 上下幅度70%
        }

        return rand(-30, 30) / 100; // 其他情況,上下浮動(dòng)30%;
    }

    /**
     * 格式化金額,保留2位
     *
     * @param float $amount
     *
     * @return float
     */
    protected function decimal_number($amount)
    {
        return sprintf('%01.2f', round($amount, 2));
    }
}

此代碼轉(zhuǎn)載至PHPhuo.org用戶葉子坑, 侵刪!
PHP 實(shí)現(xiàn)微信紅包拆分算法

$a + $a++中先執(zhí)行 $a++, $a被壓到棧中,值為3. 然后執(zhí)行++操作后$a變?yōu)?, 值為4的a被壓到棧中。
然后使用棧中的兩個(gè)值執(zhí)行加法操作,得7
示意圖

$a(3)  ->   $a(4) -> 加法操作 4 + 3

可以看出前面參與計(jì)算的$a是4, 后面參與計(jì)算的$a是3

心沉 回答

你可以看看tp中session函數(shù)源碼, 是否有前綴.

雨蝶 回答

找到問題所在了,xml格式的數(shù)據(jù)標(biāo)簽里面不能含有任何空格,去掉就好了,好坑啊,之前一直是json通訊,第一次接觸xml采坑了

離魂曲 回答

你的 @Resource(name="d1") 指定了 bean 的 name 為 d1,這樣在注入的 bean 的時(shí)候就回去尋找Datasource 類的名為 d1 的實(shí)現(xiàn),然而發(fā)現(xiàn) ioc 容器內(nèi)并沒有這個(gè) bean。

現(xiàn)在有兩種辦法:
一是直接去掉 name=d1 的指定,改寫為 @Resource,這樣就會(huì)根據(jù)類型去匹配;
二是在聲明 bean 的時(shí)候,指定這個(gè) bean 的 name 為 d1,如 @Bean(name="d1")

我記得默認(rèn)使用 @Bean 注解生成的 bean 的名稱和方法名同名,也就是你可以

    @bean 
    Datasource d1(){
        DruidDataSource d1 = new DruidDataSource();
        ...
        return d1;
    }
愚念 回答

在main.js的最上面

let exec = require('child_process').exec;    

createWindow方法(可能是其它方法,反正是監(jiān)視app的ready事件的),

exec('你啟動(dòng)server的node命令’, err => {
    if (err) {
        //...
    }
})
淚染裳 回答
我們遇到的難題是:當(dāng)用戶離開后,再次打開這個(gè)頁面時(shí),我們?nèi)绾味ㄎ换厝ミ@個(gè)節(jié)點(diǎn)node。(已知:網(wǎng)頁的節(jié)點(diǎn)不會(huì)變化,因?yàn)槲覀兙彺娴模?/blockquote>

結(jié)構(gòu)不變的情況下,XPATH 就是標(biāo)識(shí)啊, jQuery 的 selector 也一樣。

涼心人 回答

d:Anaconda3libsite-packagespymysqlconnections.py in escape(self, obj, mapping)

810                 ret = "_binary" + ret
811             return ret

--> 812 return converters.escape_item(obj, self.charset, mapping=mapping)

813
814     def literal(self, obj):

d:Anaconda3libsite-packagespymysqlconverters.py in escape_item(val, charset, mapping)

 25         val = encoder(val, charset, mapping)
 26     else:

---> 27 val = encoder(val, mapping)

 28     return val
 29

d:Anaconda3libsite-packagespymysqlconverters.py in escape_unicode(value, mapping)

116
117 def escape_unicode(value, mapping=None):

--> 118 return u"'%s'" % _escape_unicode(value)

119
120 def escape_str(value, mapping=None):

d:Anaconda3libsite-packagespymysqlconverters.py in _escape_unicode(value, mapping)

 71     Value should be unicode
 72     """

---> 73 return value.translate(_escape_table)

 74
 75 if PY2:

AttributeError: 'builtin_function_or_method' object has no attribute 'translate'

碰到了一樣的問題,抱歉我也還沒有解決,搜索到了你的問題,但是沒有發(fā)現(xiàn)答案,這個(gè)報(bào)錯(cuò)沒辦法知曉代碼哪里出現(xiàn)了紕漏

半心人 回答

你組件里加了<router-view></router-view>嗎

愛是癌 回答

估計(jì)是語法錯(cuò)誤,你看網(wǎng)頁之前有個(gè)引號(hào),你肯定是把他網(wǎng)頁輸出了、不如貼出你的控制器代碼

陌上花 回答

查了一下這些文獻(xiàn):確認(rèn)了 Ubuntu 16.04 LTS 默認(rèn)源安裝的的 samba 4.3.11 版本是修復(fù)過漏洞的

話寡 回答

你列出來的是兩個(gè)包,根據(jù)你的描述,你是不是按照第一個(gè)的文檔用的第二個(gè)包?

別硬撐 回答

CUBE的用法和Postgres數(shù)組了解一下。

with usr as (
    select user_id, array_agg(distinct product_id) as prds
    from (values('A',1),('A',1),('B',1),('C',2),('A',2),('A',3),('B',2),
        ('C',2),('D',1)) as order_list(product_id, user_id)
    group by user_id),
cmbs as ( -- combinations
    select array_remove(array[a,b,c,d], null) as cmb
    from (values('A', 'B', 'C', 'D')) as prd(a,b,c,d)
    group by cube (a,b,c,d))
select
    array_to_string(cmb, ' ') as prod,
    array_agg(user_id) as users,
    count(user_id) as tally
from cmbs inner join usr on cmb <@ prds
where array_length(cmb, 1) > 0
group by cmb
prod users tally
A {1,2,3} 3
A B {1,2} 2
A B C {2} 1
A B D {1} 1
A C {2} 1
A D {1} 1
B {1,2} 2
B C {2} 1
B D {1} 1
C {2} 1
D {1} 1
奧特蛋 回答

你可能沒弄明白運(yùn)算優(yōu)先級(jí),可以考慮用模板字符串

<div className={`icon-box ${this.state.like === true ? "icon-active" : ""}`} onClick={this.clickToLike}>
    <i className="iconfont icon-dianzan"></i>
</div>