鍍金池/ 問答/ HTML問答
吃藕丑 回答

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);
    });
  });
};
她愚我 回答

很抱歉!vue沒有提供相對應的api,vue只是一個框架,不要用了vue就不會使用javaScript了,追根究底,都要用js來獲取,和用不用vue沒有多大的關系。
獲取滾動距離的api為scrollLeft,詳情看MDN。

//獲取滾動條到元素左邊的距離
var sLeft = element.scrollLeft;
薔薇花 回答

可以了,再把組件注冊一下
thisObj.registerModule('dashboard', thisObj.state.modules.dashboard)

鐧簞噯 回答

這不是很清楚了嗎? @storybook/react升級到4.x

何蘇葉 回答

你的DifferentLabelsDiv 組件有一個todos的屬性,但是你并沒有給這個組件傳遞這個屬性,所以todosundefined,所以你調用map方法會報錯,
解決方法:

  1. 傳遞todos屬性
  2. 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,看一下

clipboard.png

瀏覽器網址那里是否有提示禁用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