在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/ HTML問答
萌面人 回答

把渲染方法抽離出來,每次操作都重新執(zhí)行此函數(shù),重新渲染

熟稔 回答

for循環(huán)是可以的。

var nodeList = document.getElementsByTagName('div'); 
for (var i = 0; i < nodeList.length; i++) {
    // code here
    console.log(1);
}

面試官可能更希望你回答出,這是array-like-object 類數(shù)組對(duì)象,怎么轉(zhuǎn)換成數(shù)組。再做循環(huán)。

方案一:ES5 Array.prototype.slice.call

var nodeList = document.getElementsByTagName('div'));
var nodeArr = Array.prototype.slice.call(nodeList);
// [].slice.call() 這個(gè)也可以
Array.isArray(nodeArr); // true
nodeArr.forEach(() => {
    console.log(1);
});

方案二:ES6 擴(kuò)展符 ...

// NodeList對(duì)象
var nodeArr = [...document.querySelectorAll('div')];
nodeArr.forEach(() => {
    console.log(1);
});

方案三:ES6 Array.from

Array.from(document.querySelectorAll('div')).forEach(() => {
    // code here
    console.log(1);
});

面試官應(yīng)該是想要你說出轉(zhuǎn)成數(shù)組這三種方案。希望對(duì)你有幫助~

貓館 回答

自己解決了,關(guān)鍵是重新初始化了數(shù)據(jù),每次彈出框的時(shí)候,將數(shù)據(jù)拷貝一份,傳入組件,
每次重新渲染組件的方式就是用v-if
<synctree v-if="reloadTree" :data.sync="tempList" v-model="finalData"></synctree>
每次點(diǎn)擊的時(shí)候重新渲染,不過這樣有個(gè)弊端,數(shù)據(jù)多了性能差,希望大家能有其他的解決辦法

     handleAdd() {
        this.reloadTree = true
        // 拷貝數(shù)據(jù)
        this.tempList = deepClone(this.originData)
        // 修改不可選數(shù)據(jù)disabled屬性
        this.disabledKeys.forEach(key => {
          this.tempList.forEach(item => {
            if (key === item.id) {
              this.$set(item, 'disabled', true)
            }
          })
        })
        // 顯示彈框
        this.dialogVisible = true
      },

閑了會(huì)去整理一個(gè)小的demo出來,歡迎去我的github圍觀
clipboard.png

只愛你 回答

我覺得是純手打的,因?yàn)楹芏嘭Q直方向的邊界線都沒有對(duì)齊,markdown也沒有對(duì)應(yīng)的支持,另外如果不是純文本環(huán)境的話,這種圖形還是化成圖比較好,又是矩形又是箭頭的

淺淺 回答

先說一個(gè)最原始的方法實(shí)現(xiàn)

class Dispatcher {
    constructor() {
        this._event = [];
    }
    on(eventName, fn) {
        var subscription = {
            eventName,
            callback: fn
        };
        this._event.push(subscription);
        return this;
    }
    off(eventName, fn) {
        this._event = this._event.filter(
            subscription => !(subscription.eventName === eventName && (fn ? subscription.callback === fn : true))
        );
        return this;
    }
    emit(eventName, ...data) {
        this._event.forEach(subscription => {
            if (subscription.eventName === eventName) {
                subscription.callback(...data);
            }
        });
        return this;
    }
}

var leftList = [
    {productId: 10006},
    {productId: 10031},
    {productId: 10016},
    {productId: 10017},
];


var leftList = leftList.map((item, index) => ({...item, order: index,}));

var rightList = [];

var dispatch = new Dispatcher();

dispatch.on('select', function(product) {
    leftList = leftList.filter(_product => product !== _product);
    rightList.push(product);
});

dispatch.on('unselect', function(product) {
    rightList = rightList.filter(_product => product !== _product);
    leftList.push(product);
});

dispatch.emit('select', leftList[0]);
console.log('leftList: ', [...leftList],'\n', 'rightList', [...rightList]);

dispatch.emit('unselect', rightList[0]);
console.log('leftList: ', [...leftList],'\n', 'rightList', [...rightList]);

然后再說一個(gè)比較Vue的,左右兩列應(yīng)該算兄弟組件之間的通信,組件的代碼和視圖的代碼應(yīng)該在兩個(gè)js文件。組件的通信可以通過子組建1 -> 父組件 -> 子組建2,但是比較麻煩。

我感覺可以用Vuex了。

夕顏 回答

使用ended事件

    var audio = document.getElementById("audio"); 
    audio.loop = false;
    audio.addEventListener('ended', function () {  
        //換地址
    }, false);
孤島 回答

chrome cookie不支持本地協(xié)議,就是通過file://xxx.html這樣子訪問
如果你把該文件通過web服務(wù)器訪問就可以。

尋仙 回答

具體看你的用法: route.push()


更新:如 路人 所說,這里使用 store 傳遞參數(shù)會(huì)比較好(之前沒有認(rèn)真讀題 - - !)。

貓館 回答

<body>

<a class="qs">簽收1</a>
<a class="qs">簽收2</a>
<a class="qs">簽收3</a>
<a class="qs">簽收4</a>

<script>

$(".qs").on('click', function() {
    $(this).context.innerText = 'xxx'
})

</script>

先全局裝個(gè) rimraf, 然后嘗試:

npm install -g rimraf
rimraf node_modules
npm install

npm 版本是多少? 如果有 package-lock.json 這個(gè)文件,則先刪除再 npm install

補(bǔ)充:

npm install babel-preset-react -D

在項(xiàng)目根目錄新建個(gè)文件 .babelrc, 把 package.json 里的 babel 刪掉。

{
  "presets": ["env", "react"]
}
乖乖噠 回答

我覺得還是你的布局的代碼沒寫對(duì),不是因?yàn)閝uill自動(dòng)獲取了焦點(diǎn)

+event.target.value會(huì)把小數(shù)點(diǎn)過濾掉,所以必須把+去掉

handleChange(event) {
    this.setState({value: event.target.value});
}
吃藕丑 回答

<img :src="placeImg" >

export default {

props: {
    placeImg: require('~/assets/img/abc.png')
}

}

替身 回答

想要轉(zhuǎn)換成這種?

let result = [{id: '1'}, {id: '1'}, {id: '3'}];
let ids = ['1', '2', '3'];
let result = ids.map(el => {
    return {
        id: el
    };
});
離夢(mèng) 回答

目前使用一條曲線作為基礎(chǔ)線,再加第二條曲線模擬圓點(diǎn),再加第三條曲線覆蓋第二條曲線只剩個(gè)頭。
勉強(qiáng)實(shí)現(xiàn)了需求。不好的地方是圓點(diǎn)只能用顏色做區(qū)分,不能更大。

慢半拍 回答

emmmmm 吃飯前等人,就簡單實(shí)現(xiàn)了一個(gè),但是不知道兼容性咋樣。。主要用的就是 css3 的 clip 屬性

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    div {
      width: 400px;
      height: 40px;
      line-height: 40px;
      text-align: center;
    }
    .progress-container {
      position: relative;
      border: 1px solid black;
      font-size: 28px;
    }
    .skyblue {
      position: absolute;
      top: 0;
      z-index: 1;
      background: skyblue;
      color: white;
    }
    .white {
      position: absolute;
      top: 0;
      z-index: 2;
      background: white;
      color: skyblue;
      clip: rect(auto auto auto 194px);
    }
  </style>
</head>
<body>
  <div class="progress-container">
    <div class="skyblue">50%</div>
    <div class="white">50%</div>
  </div>
</body>
</html>

原理大概這樣:

包裹的容器里有兩個(gè)初始定位一樣的 div
底下的 div 長這樣:
圖片描述

上面的 div 長這樣:

圖片描述

之后根據(jù)進(jìn)度用 js 來調(diào)整 clip: rect(top, right, bottom, left) 中的屬性值就行了,這個(gè)例子里調(diào)整的是 left

筱饞貓 回答

看不到你的html文件的問題,感覺用/static根路徑不太對(duì),相對(duì)路徑應(yīng)該不會(huì)出錯(cuò)。

尛曖昧 回答

設(shè)置為checkStrictly時(shí),組件完全變成可控組件。
子父關(guān)系沒有關(guān)聯(lián)。

苦妄 回答

github 上這個(gè)項(xiàng)目已經(jīng)廢棄了,報(bào)錯(cuò)是這個(gè)項(xiàng)目引用的還是舊版本 React,新版本 React 已經(jīng)不自帶 PropTypes 了。


PS:試試這個(gè)react-native-swiper?