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

鍍金池/ 問答
好難瘦 回答

為什么要寫那么復(fù)雜?

import React, { Component } from 'react'
import './styles.css'

class App extends Component {
  constructor() {
    super()
    this.state = {
      list: ['A', 'B', 'C', 'D'],
      current: 0,

      content: [
        ['img a-1', 'img a-2', 'img a-3'],
        ['img b-1', 'img b-2', 'img b-3'],
        ['img c-1', 'img c-2', 'img c-3'],
        ['img d-1', 'img d-2', 'img d-3']
      ]
    }
  }

  handleClick = index => this.setState({ current: index })

  render() {
    return (
      <div className="tab-panel">
        <ul className="tabs">
          {this.state.list.map((v, i) => (
            <li
              key={v}
              className={i === this.state.current ? 'active' : ''}
              onClick={() => this.handleClick(i)}
            >
              {v}
            </li>
          ))}
        </ul>

        <ul className="content-container">
          {this.state.content.map(
            (v, i) =>
              v.length && (
                <li key={i} className={i === this.state.current ? 'show' : 'hidden'}>
                  {v.map((img, index) => <img key={index} src={img} alt={img} />)}
                </li>
              )
          )}
        </ul>
      </div>
    )
  }
}

export default App
敢試 回答

v-show當(dāng)頁面進(jìn)來時就渲染了 只不過是用css display:none屬性隱藏掉了,當(dāng)然不會刷新了。
建議你去看看 v-if和v-show的區(qū)別

冷咖啡 回答
  1. debouncethrottle是目前用得最廣泛的,具體可見樓上的一堆收藏;
  2. 想要確保邏輯上不會有同時提交的請求,npm搜“mutex”也有很多;
  3. 或者我也寫了一個簡易版的,用下面的函數(shù)包裹點擊回調(diào),如果前一次請求尚未結(jié)束,新請求會和舊請求一起返回。這樣的話回調(diào)要返回Promise

    const debounceAsync = originalFunction => {
      let currentExcution = null;
      const wrappedFunction = async function () {
        // 1. locked => return lock
        if (currentExcution) return currentExcution;
    
        // 2. released => apply
        currentExcution = originalFunction.apply(this, arguments);
        try {
          return await currentExcution;
        }
        finally {
          currentExcution = null;
        }
      };
      return wrappedFunction;
    };

    用法

    const sleep = (ms = 0) => new Promise(resolve => setTimeout(resolve, ms));
    
    const debounceAsync_UNIT_TEST = async () => {
      const goodnight = debounceAsync(sleep);
      for (let i = 0; i < 8; i++) {
        goodnight(5000).then(() => console.log(Date()));
        await sleep(500);
      }
      console.warn('Expected output: 8 identical datetime');
    };

    https://segmentfault.com/a/11...

念舊 回答

看人家返回給你的是什么內(nèi)容了,如果是blob,這樣

jsFileDownload (filename, data, mime) {
    let blob = new Blob([data], {type: mime || 'application/octet-stream'})
    if (typeof window.navigator.msSaveBlob !== 'undefined') {
      window.navigator.msSaveBlob(blob, filename)
    } else {
      var blobURL = window.URL.createObjectURL(blob)
      var tempLink = document.createElement('a')
      tempLink.style.display = 'none'
      tempLink.href = blobURL
      tempLink.setAttribute('download', filename)
      if (typeof tempLink.download === 'undefined') {
        tempLink.setAttribute('target', '_blank')
      }
      document.body.appendChild(tempLink)
      tempLink.click()
      document.body.removeChild(tempLink)
      window.URL.revokeObjectURL(blobURL)
    }
  }

如果是url,那就很簡單了,沒必要我寫了

陌離殤 回答

jquery對象和dom對象,jquery方法和dom方法了解一下

尐懶貓 回答
跨源數(shù)據(jù)存儲訪問
存儲在瀏覽器中的數(shù)據(jù),如localStorage和IndexedDB,以源進(jìn)行分割。每個源都擁有自己單獨的存儲空間,一個源中的Javascript腳本不能對屬于其它源的數(shù)據(jù)進(jìn)行讀寫操作。

Cookies 使用不同的源定義方式。一個頁面可以為本域和任何父域設(shè)置cookie,只要是父域不是公共后綴(public suffix)即可。Firefox 和 Chrome 使用 Public Suffix List 決定一個域是否是一個公共后綴(public suffix)。Internet Explorer使用其自己的內(nèi)部方法來確定域是否是公共后綴。不管使用哪個協(xié)議(HTTP/HTTPS)或端口號,瀏覽器都允許給定的域以及其任何子域名(sub-domains) 訪問 cookie。設(shè)置 cookie 時,你可以使用Domain,Path,Secure,和Http-Only標(biāo)記來限定其訪問性。讀取 cookie 時,不會知曉它的出處。 即使您僅使用安全的https連接,您看到的任何cookie都可能使用不安全的連接進(jìn)行設(shè)置。

所以是不能跨域

理由 阮一峰 瀏覽器同源政策及其規(guī)避方法

MDN Same-origin policy

艷骨 回答

var video=document.getElementById("v");
video.addEventListener('play',function(){

$('.廣告').hide();     

});
video.addEventListener('pause',function(){

$('.廣告').show();  

})

你的瞳 回答

也遇到這個問題,請問你你解決了嗎

寫個傳參方法,調(diào)用10次

命于你 回答

跨域了,請求的地址不允許來自'http://localhost:8080'的請求

終相守 回答

找到原因了,因為引入了rem.js 包裹swiper的容器設(shè)置的margin采用的rem單位,到時計算的時候,每個slide有一點點損耗引起的
解決辦法,外邊距直接用px單位,即可

舊顏 回答

看下大佬的文章就知道了 手摸手,帶你用vue擼后臺 系列二(登錄權(quán)限篇)

沒啥特殊需求老老實實把路由寫到前端吧,寫到接口里面就是自己跟自己搞事情。

落殤 回答

問你們后端去。一般來說,session是瀏覽器管理的,你不需要做什么,這種情況,就是后端的session沒寫好。

柒喵 回答

找到原因了,是我的鍋,調(diào)grpc如果返回error,前面那個變量*push.RegisterResponse,就默認(rèn)返回nil,然后我在測試?yán)镌噲D訪問以res.Msg的形式獲取錯誤信息,res是nil,就有了invalid memory address or nil pointer dereference的錯

練命 回答

http -> upgrade -> 服務(wù)器同意 -> 升級為websocket -> 該干嘛干嘛
一不一個頁面沒什么所謂。

笑浮塵 回答

已經(jīng)解決,就是數(shù)組最高元素的數(shù)值

舊城人 回答

這個不難,直接調(diào)用授權(quán)那個接口,用戶若點擊不允許,則下次再次點擊判斷用戶是否拒絕授權(quán),拒絕就打開用戶設(shè)置。這就是正常做法

做不到 回答

computed方法會在頁面初始化的時候執(zhí)行一次,第一次應(yīng)該是被return掉才執(zhí)行setinterval,然后是函數(shù)內(nèi)部中使用的data中的屬性發(fā)生變化的時候才會執(zhí)行,你點擊的事件并沒有改變time_60 這個值,所以count_down并沒有執(zhí)行,刷新后應(yīng)為cook中有值,沒有被return 才會運行setinterval;1樓說的對,這樣的邏輯不適合寫在計算屬性中,應(yīng)該定義在methods中,在掉接口的回調(diào)中運行比較合適。
還有個問題count_down中沒有return 任何有效值,看你的邏輯,應(yīng)該只會展示undefined和null.