鍍金池/ 問答/ HTML問答
絯孑氣 回答

使用react-router的createElement解決!
Router.js

......
...... // 省略其他無關緊要代碼

// 此處為要點擊刷新的組件
const arr = [
    home
];

// 開關優(yōu)化
let onOff =false;

// 頁面強制刷新,如果需要強制刷新在路由中添加onChange事件以及在組件數(shù)組添加
const createElement=(component, props) =>{
    if (props.children && onOff || props.children && arr.includes(props.routes.slice(-1)[0].getComponent)) {
        let children = Object.assign({}, props.children, {key : `${window.location.pathname}` + new Date().getTime()})
        props = { ...props, children };
        onOff = false;
    }
    return React.createElement(component, props)
}

const onChange = (props, next) => {
    onOff = true
    console.log(`${next.location.pathname}`, 'change');
}

const RouteConfig = (
    <Router history={history} createElement = {createElement}>
        <Route path="/home" getComponent={home} onChange = {onChange} />
        ...
        ...
    </Router>
);

export default RouteConfig;

如果您用的react-router4.0,當使用 component 時,router 將使用 React.createElement 根據(jù)給定的 component 創(chuàng)建一個新的 React 元素。這意味著如果你使用內(nèi)聯(lián)函數(shù)(inline function)傳值給 component將會產(chǎn)生不必要的重復裝載。對于內(nèi)聯(lián)渲染(inline rendering), 建議使用 renderprop。
也可以參考下我新寫的文章:這里有沒有你想要的react-router

選擇 回答

不是上面的這個index報的錯么?:index="secMenu.id"包層:index="String(secMenu.id)"行不行。

任她鬧 回答

ECHARTS收到數(shù)據(jù)后怎么渲染到頁面上面呢?ECHARTS是個組件。數(shù)據(jù)已經(jīng)在組件接收到了?

殘淚 回答

啥意思,你寫上什么色加載進來就是什么色,沒有動畫效果。
要是有,你肯定寫了什么別的色對它有影響。

慢半拍 回答

如果對順序有要求的話再按id用sort方法排序一下。。
想了半天。。不知道有沒有算法復雜度更低的寫法。。

const fn = (arr, ...arrOther) => {
  let hash = {}
  return arr.concat(...arrOther).reduceRight((iter, v) => {
    if(!hash[v.id]) {
      hash[v.id] = true
      iter.push(v) 
    }
    return iter
  }, [])
}

var arr1 =[{id:1,name:1},{id:2,name:2},{id:3,name:3}]
var arr2 =[{id:1,name:111}]
var arr3 =[{id:4,name:44},{id:5,name:55}]

fn(arr1, arr2, arr3)
老梗 回答

給圖片加一個時間戳參數(shù)唄

你好胸 回答

應該是墻的原因 我測試了一下我的環(huán)境可以

clipboard.png

建議您試試
可以通過修改npm的配置文件讓npm到另外的pacakge mirror站點去找package,通過如下命令
$ npm config set registry https://registry.npm.taobao.org
$ npm config set registry http://r.cnpmjs.org
或者:npm config set registry http://registry.npmjs.eu
隨后再執(zhí)行
npm install

像我就是用的taobao鏡像

clipboard.png

氕氘氚 回答

你用的webpack是哪個版本的,最新版的4.0出來了,把HtmlWebpackPlugin舍棄了,需要特別下載才行

$> yarn add html-webpack-plugin@webpack-contrib/html-webpack-plugin
苦妄 回答

....你這不就是完全匹配嗎?直接全匹配上去就好了撒。

let msg = ''; // 后臺返回

if (/信息一致, 匹配成功/.test(msg)) {
  // 文字綠色
} else if (/不一致/.test(msg)) {
  // 文字紅色
} else {
  // 都不匹配...
}
夢一場 回答

一樣的呀 yarn add git+ssh://git@git地址

黑與白 回答

url你寫成 uri了

殘淚 回答

個人覺得可能有兩方面原因:
1:沒有設置src
2.Your player is ready,只是表明video.js做好了準備,但視頻資源也許因為網(wǎng)速原因,壓根就沒加載,所以this.duration()會為NAN,你可以在loadstart監(jiān)聽中獲取這個時長

薄荷糖 回答

現(xiàn)在解決了嗎 我也遇見了這種情況 你是怎么解決的

心悲涼 回答

1.在其他瀏覽器比如chrome里看看請求返回的信息對不對
2.猜測很大原因是因為跨域了,設置一下請求頭

真難過 回答

.parents(),.clone(),.insertAfter()
$(this)用parents加選擇器找到目標dom,然后clone下再insertAfter到目標位置后邊(兄弟級別)。如果clone沒清空的話那再手動清下就好。

背叛者 回答

https://github.com/ElemeFE/el...

issues 中類似問題的回復是,Vue 的版本需要 2.5.2 以上。