使用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)境可以
建議您試試
可以通過修改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鏡像
你用的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)在解決了嗎 我也遇見了這種情況 你是怎么解決的
props 傳參
你想說這個?
1.在其他瀏覽器比如chrome里看看請求返回的信息對不對
2.猜測很大原因是因為跨域了,設置一下請求頭
.parents(),.clone(),.insertAfter()
$(this)用parents加選擇器找到目標dom,然后clone下再insertAfter到目標位置后邊(兄弟級別)。如果clone沒清空的話那再手動清下就好。
https://github.com/ElemeFE/el...
issues 中類似問題的回復是,Vue 的版本需要 2.5.2 以上。
北大青鳥APTECH成立于1999年。依托北京大學優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國家
北大青鳥中博軟件學院創(chuàng)立于2003年,作為華東區(qū)著名互聯(lián)網(wǎng)學院和江蘇省首批服務外包人才培訓基地,中博成功培育了近30000名軟件工程師走向高薪崗位,合作企業(yè)超4
中公教育集團創(chuàng)建于1999年,經(jīng)過二十年潛心發(fā)展,已由一家北大畢業(yè)生自主創(chuàng)業(yè)的信息技術與教育服務機構(gòu),發(fā)展為教育服務業(yè)的綜合性企業(yè)集團,成為集合面授教學培訓、網(wǎng)
達內(nèi)教育集團成立于2002年,是一家由留學海歸創(chuàng)辦的高端職業(yè)教育培訓機構(gòu),是中國一站式人才培養(yǎng)平臺、一站式人才輸送平臺。2014年4月3日在美國成功上市,融資1
曾工作于聯(lián)想擔任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔任項目經(jīng)理從事移動互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍懿科技有限責任公司從事總經(jīng)理職務負責iOS教學及管理工作。
浪潮集團項目經(jīng)理。精通Java與.NET 技術, 熟練的跨平臺面向?qū)ο箝_發(fā)經(jīng)驗,技術功底深厚。 授課風格 授課風格清新自然、條理清晰、主次分明、重點難點突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁制作和網(wǎng)頁游戲開發(fā)。
具有10 年的Java 企業(yè)應用開發(fā)經(jīng)驗。曾經(jīng)歷任德國Software AG 技術顧問,美國Dachieve 系統(tǒng)架構(gòu)師,美國AngelEngineers Inc. 系統(tǒng)架構(gòu)師。