鍍金池/ 問答/ HTML問答
尛憇藌 回答

原因

永遠無法執(zhí)行到的代碼就會這樣顯示

示例

const test = () => {
const a = 1;
return 2;
console.log(11);  //這一行也會出現(xiàn)你這種情況,因為他永遠無法執(zhí)行
}
孤酒 回答

圖片描述

我也遇到這個問題了,現(xiàn)在解決了,但是我忘了我怎么操作的,你可以試試把項目設置里面的“不校驗安全域名.....”勾上,看看還會不會報錯?等我想起來再來回答你,?

放開她 回答

你對圖片路徑做了說明處理么?

筱饞貓 回答

在Linechart.js寫props

    props: {
        Data: {
          type: Array,
          default: []
        },
    }

在example.vue傳數(shù)據(jù)過去

<line-chart 
    :width="370" 
    :height="246"
    :Data="data">
</line-chart>

這樣Linechart.js就能拿到數(shù)組

神曲 回答

感覺像是node版本問題,前幾天我剛用yarn裝過@vue/cli
另外yarn我設置了阿里的鏡像源。
我的版本信息如下:
clipboard.png
希望能對你有所幫助。
vue create 創(chuàng)建項目時如果選擇了SASS 需要安裝python 2.x 版本。

clipboard.png

苦妄 回答

bindscrolltoupper 這個能滿足嗎 也是 scroll-view 中的方法

陌璃 回答

沒有驗證過,但是我個人理解是 用session 的話,如果登陸信息放緩存,那么重啟肯定沒了,如果放數(shù)據(jù)庫那還有。
用token的話,只要時間不過期,登陸狀態(tài)應該不會消失。

放開她 回答
class PrivateRoute extends React.Component {

    render(){
        const { component: Component, ...rest } = this.props
        
        return (
            <Route
                {...rest}
                render={props =>
                  fakeAuth.isAuthenticated ? (
                    <Component {...props} />
                  ) : (
                    <Redirect
                      to={{
                        pathname: "/login",
                        state: { from: props.location }
                      }}
                    />
                  )
                }
              />)
    }
  
}
薄荷糖 回答

路由重定向
react-router 路由寫法 (先導入基本的組件)

  <HashRouter>
        <Switch>        
         
          <Route path="/index"  component={home} />
          <Route path="/record" component={record} /> 
          <Redirect from="/" to="/index"  />
        </Switch>
      </HashRouter>

vue-router 寫法

 {
      path: '/',
      redirect: '/index',
},
{ 
      path: '/index',
      name: 'index',
      component: home,
    
}
奧特蛋 回答

如果在前端能看到這個cookie的值和value,那么在路由里同樣可以取到cookie,無非是對document.cookie進行操作(可以自己封裝幾個方法,判斷cookie是否存在,獲取cookie的值,設置cookie),身份校驗之類的信息,沒必要存在localStorage里

葬憶 回答

播放不了
如果你是想播放騰訊視頻的話,直接跳轉(zhuǎn)到視頻鏈接就行了

悶油瓶 回答

<transition name="fade" mode="out-in">
<router-view :key="當前時間戳即可">
</router-view>
</transition>

悶油瓶 回答

.eslintrc.js 的 rules 加上

"vue/no-parsing-error": [2, { "x-invalid-end-tag": false }]

其他解釋可見 iview--issue

夕顏 回答

https://reactjs.org/docs/reac...
setState() enqueues changes to the component state and tells React that this component and its children need to be re-rendered with the updated state. This is the primary method you use to update the user interface in response to event handlers and server responses.
以上是官方文檔對批量setState的解釋,只說了說setState會排隊,但實際上,在當前版本中,在不同的地方批量執(zhí)行setState會有不同的表現(xiàn)。

以下是官方文檔中給的一個鏈接,說明在什么時候setState會被批量處理
In depth: When and why are setState() calls batched?(深入了解:什么時候并且為什么setState()調(diào)用會被合并)

Currently (React 16 and earlier), only updates inside React event handlers are batched by default. There is an unstable API to force batching outside of event handlers for rare cases when you need it.

In future versions (probably React 17 and later), React will batch all updates by default so you won't have to think about this. As always, we will announce any changes about this on the React blog and in the release notes.
現(xiàn)在(React 16 和之前),在默認情況下,只有直接在react生命周期React event handlers里寫的setState會被合并處理
未來版本(大概從React 17 開始),React會默認合并所有的setState

下面官方文檔中給的另一個鏈接
In depth: Why isn’t this.state updated immediately?(深入了解:為什么this.state沒有被立刻更新?)

陌離殤 回答

加上scoped,是加上了屬性名,就是局部的了。
這又不是為了好看。你為啥要糾結(jié)這個,用戶又不看這個。
不想加scoped,也可以最外層包裹一層呀。
比如:

<style lang="less">
    .wrap{
        // ...
    }
</style>
安若晴 回答

先將id打印出來看一看,然后代碼改進

// this.userList.forEach...
this.userInfo = this.userList.find(item => item.id === id)