for in有人說了,還有Object.keys,當然前提是兼容性好,ie什么的就算了吧
console.log( Object.keys(a));
如果想弄個完善的權限管理系統(tǒng),可以模擬下linux的,簡單來說就是:
1,建立角色(組)
2,用戶屬于哪個組
3,組里面有哪些權限(比如哪幾個頁面的查看權限,或則頁面里面增加按鈕的權限)
這樣用戶登錄之后就可以,根據用戶找到其屬于哪個組,進而知道這個組有哪些權限。
我有個系統(tǒng)就是這么做的,感覺還比較方便的。
已經解決,方案如下:
請求頭設置:
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'
并且把受到的JSON參數(shù)拼接到url中:
let getUrl = (url, body, isForm) => {
var b = '';
for (var bo in body) {
b += `&${bo}=${body[bo]}`;
}
if (b.substr(0, 1) == '&') b = b.substr(1);
if (isForm) {
return b;
}
if (url.indexOf('?') === -1) {
return `${url}?$`;
}
return `${url}&$`;
};
完整的代碼:
let getUrl = (url, body, isForm) => {
var b = '';
for (var bo in body) {
b += `&${bo}=${body[bo]}`;
}
if (b.substr(0, 1) == '&') b = b.substr(1);
if (isForm) {
return b;
}
if (url.indexOf('?') === -1) {
return `${url}?$`;
}
return `${url}&$`;
};
export const request = (url, method, body, isUrlParam, notice, popNoticeSuccess = false) => {
let isOk;
return new Promise((resolve, reject) => {
var opt = {
method,
headers: {
'Accept': 'application/json',
//'Content-Type': 'application/json;charset=utf-8'
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'
}
}
if (isUrlParam)
url = getUrl(url, body, false);
else
opt.body = getUrl(url, body, true);
//alert(JSON.stringify(opt));
fetch(url, opt).then((response) => {
if (response.ok) {
isOk = true;
} else {
isOk = false;
}
return response.json();
}).then((responseData) => {
if (isOk) {
if (responseData.code == 1) {
if (popNoticeSuccess) {
notice('suc', responseData.msg);
}
//console.log(JSON.stringify(responseData));
resolve(responseData.data);
} else {
notice('err', responseData.msg);
reject(responseData.data);
}
} else {
reject(responseData.data);
}
}).catch((error) => {
reject(error);
});
});
};
可以了,再把組件注冊一下
thisObj.registerModule('dashboard', thisObj.state.modules.dashboard)
這不是很清楚了嗎? @storybook/react升級到4.x
你的DifferentLabelsDiv
組件有一個todos
的屬性,但是你并沒有給這個組件傳遞這個屬性,所以todos
是undefined
,所以你調用map
方法會報錯,
解決方法:
todos
屬性DifferentLabelsDiv
這個組件一個默認的todos
屬性。已經涼了這個問題?
你是問二維碼怎么生成嗎?
百度qrcode.js
https://github.com/davidshimj...
var qrcode = new QRCode("test", {
text: "http://www.runoob.com",
width: 128,
height: 128,
colorDark : "#000000",
colorLight : "#ffffff",
correctLevel : QRCode.CorrectLevel.H
});
可以使用代理啊,將localhost/api/轉發(fā)到example.com/
在開發(fā)環(huán)境中可以配置devServer的proxyTable
在正式環(huán)境中可以配置nginx、tomcat等服務器的轉發(fā)規(guī)則
測試了一下、確實選中的灰色塊下面溢出了、
看著有些許別扭、
(本人后端、請忽略我的審美)
ArrayAdapter requires the resource ID to be a TextView,你請求的是adapter用的資源id應該是一個textView控件的id。根據你寫的adapter繼承的ArrayAdapter的的構造函數(shù)看,他需要傳的是一個textview控件的資源id而不是一個布局的資源id
你得思路沒有錯,把你得代碼復制出來測試了也沒有問題。唯一有問題得地方就是 isEdit=!isEdit 的感嘆號是中文的。
不行的,下一次有可能拿不到
如果你是在chrome瀏覽器下,可能是因為禁用了flash,看一下
瀏覽器網址那里是否有提示禁用flash
可以在指令的宿主元素下加一個ng-container
作為動態(tài)組件容器,ng-container
會在渲染時消失。
指令可以做一些修改:
@Directive({
selector: '[appTxt]'
})
export class TxtCopyDirective {
@Input('appTxt') dyView:any
constructor(
private el: ElementRef,
private renderer2: Renderer2,
public viewContainerRef: ViewContainerRef,
private componentFactoryResolver: ComponentFactoryResolver
) {}
@HostListener('click', ['$event']) onclick(event: any) {
this.dyView.clear();
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(動態(tài)組件);
this.dyView.createComponent(componentFactory);
}
}
目標元素:
<span [appTxt]="dyView">
click
<ng-container #dy></ng-container>
</span>
目標元素所在組件獲取ng-container
容器作為參數(shù)傳給指令:
@ViewChild('dy',{read:ViewContainerRef}) dyView:ViewContainerRef
卸載相關插件
require('./pages/home.vue')
antd是用less寫的,所以應該是要在less的配置里也用ExtractTextPlugin
試試設置 limit 和 on-exceed
北大青鳥APTECH成立于1999年。依托北京大學優(yōu)質雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數(shù)據專業(yè)的國家
北大青鳥中博軟件學院創(chuàng)立于2003年,作為華東區(qū)著名互聯(lián)網學院和江蘇省首批服務外包人才培訓基地,中博成功培育了近30000名軟件工程師走向高薪崗位,合作企業(yè)超4
中公教育集團創(chuàng)建于1999年,經過二十年潛心發(fā)展,已由一家北大畢業(yè)生自主創(chuàng)業(yè)的信息技術與教育服務機構,發(fā)展為教育服務業(yè)的綜合性企業(yè)集團,成為集合面授教學培訓、網
達內教育集團成立于2002年,是一家由留學海歸創(chuàng)辦的高端職業(yè)教育培訓機構,是中國一站式人才培養(yǎng)平臺、一站式人才輸送平臺。2014年4月3日在美國成功上市,融資1
曾工作于聯(lián)想擔任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔任項目經理從事移動互聯(lián)網管理及研發(fā)工作,曾創(chuàng)辦藍懿科技有限責任公司從事總經理職務負責iOS教學及管理工作。
浪潮集團項目經理。精通Java與.NET 技術, 熟練的跨平臺面向對象開發(fā)經驗,技術功底深厚。 授課風格 授課風格清新自然、條理清晰、主次分明、重點難點突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網頁制作和網頁游戲開發(fā)。
具有10 年的Java 企業(yè)應用開發(fā)經驗。曾經歷任德國Software AG 技術顧問,美國Dachieve 系統(tǒng)架構師,美國AngelEngineers Inc. 系統(tǒng)架構師。