鍍金池/ 問答/ HTML問答
薄荷綠 回答

for每次循環(huán)生成一個新的作用域,fuction內(nèi)的i訪問的是這個作用域內(nèi)的i,大概可以像這樣理解:

var a = [];
for (let i = 0; i < 10; i++) {
  a[i] = function () {
    let j=i
    console.log(j);
  };
}
a[6](); // 6

可以將源代碼使用 babel轉義看看:

clipboard.png

夢一場 回答

謝邀~

<el-input
  class="input-class"
  placeholder="請輸入內(nèi)容"
  v-model="input1"
  :disabled="true">
</el-input>
.input-class{
    width: 500px;
    height: 40px;
}

這樣即可。
// 關于date-picker 可以根據(jù)渲染處理的樣式名追加樣式呀

<div class="block">
    <span class="demonstration">默認</span>
    <el-date-picker class="input-class" v-model="value1" type="date" placeholder="選擇日期">
    </el-date-picker>
</div>
.input-class{
  .el-input__inner{
    width: 50px; 
  }  
}

webpack打包后scoped的樣式丟失,有兩種方案。1、單獨樣式不用scoped,2、使用/deep/。

// 單獨給這個input寫個style
<style lang="less">
 .input-class{
  .el-input__inner{
    width: 50px; 
  }  
}
</style>
<style lang="less" scoped>
.other{}
</style>

或者用深度選擇器/deep/。具體查看官方文檔

奧特蛋 回答

看看官網(wǎng)文檔transition,你明顯少了css

念初 回答

token 如果你的app類似銀行涉及到資金安全,那么建議token生成按照ip生成

荒城 回答

npm run build 行不行

我甘愿 回答

v-validate綁定一個動態(tài)值,例如為validate,拒絕,則validate= 'require',通過則validate = ''

雅痞 回答

6.x 的 rxjs 接口有變化,應該這樣寫:

import { Observable, of } from 'rxjs';
import { catchError, map, tap } from 'rxjs/operators';
祈歡 回答

很不幸我300條的時候點擊下拉都有明顯卡頓

想想這種設計本身就不合理,3000條數(shù)據(jù)一次性從后端都扔給前端,用戶也不可能去選擇某一條,不如改為remote-search的解決方案

命于你 回答

forEach會把你的函數(shù)多封裝一層,自然無法return

const findSelectedLabel = (items, name) => {
  for (let i = 0; i != items.length; ++i) {
    const item = items[i]
    if (item.name === name) {
      return item.label
    } else if (item.items && Array.isArray(item.items)) {
      const label = findSelectedLabel(item.items, name)
      if (label) {
        return label
      }
    }
  }
}

const label = findSelectedLabel(navItems, navName)
console.log(`find ${navName} -> ${label}`)
巫婆 回答
  1. 首先問題限定了是“背景圖片”,所以可以排除掉大部分素材站了
  2. 可以考慮下桌面網(wǎng)站,但鑒于國內(nèi)大部分桌面站提供圖片的質(zhì)量,嘖嘖嘖……建議還是優(yōu)先歐美吧。
  3. “設計/UI去哪了?”
  4. 給幾個站,可以參考。純圖片可以去wallhaven去找(注意搜索時可以選擇分辨率和寬高比,另外我電腦桌面也會去這里翻翻);如果想趕時髦用視頻做背景的話,可以去mazwai看看;如果是想素一點、用紋理repeat來做背景,那么可以去subtlepatterns看看;如果用紋理的時候還想加點背景色(即透明紋理),那么去transparenttextures找就可以了。
  5. 至于寬度,亦即響應式斷點,我覺得桌面端可以考慮從1280起步,到1920就可以了。
離殤 回答
想請問是這兩個在一起比mysql更搭配嗎?

并沒有。

網(wǎng)上查找的資料都是node加上mongodb

因為很多人,連基本的 SQL 語句,關系數(shù)據(jù)庫模式的概念,都不會。

眼雜 回答

是遮罩層的background設置透明度,不是遮罩層本身設置opacity,這樣的話,彈出框就不會有透明度了,一般彈框都是在寫遮罩層內(nèi)部的

司令 回答

第一步安裝包:

yarn add -D typescript jest ts-jest @types/jest

第二步初始化項目相關配置文件:
生成tsconfig.json:

tsc --init

創(chuàng)建jest.config.js:

module.exports = {
  transform: {
    '^.+\\.tsx?$': 'ts-jest',
  },
  testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
  moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
}

目錄結構:

clipboard.png

base.spec.ts:

import { sampleFunction } from "../src";

test('adds 1 + 2 to equal 3', () => {
    expect(sampleFunction("hello")).toBe("hellohello");
});

結果:

clipboard.png

舊時光 回答

v-html可破。

ps: 遇到問題多看看教程,教程都是有寫的。

背叛者 回答

個人理解
比如:

 <Route exact path="/Home" component={Home}/>
 
 1.只有包裹在Route組件里的才能使用`this.props.location`,
 2.假如有個需求,是面包屑或者導航組件里需要拿到`this.props.location`(導航組件或者面包屑一般不會包裹在`Route`里吧),那么直接這么寫顯然就不行了。
 這個時候`withRouter`修飾一下,就可以這么寫了。
妖妖 回答

data中定義一個數(shù)組list,存儲所有itemindex之類的標志性的東西。每個item點擊的時候觸發(fā)一個事件,并且以index作為參數(shù),然后在事件中處理這個index相鄰的index。