鍍金池/ 問(wèn)答
做不到 回答

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

巷尾 回答

That's easy. 我給你翻譯下這段歌詞:

defmodule Chop do
  def guess(actual, range = low..high) do
    guess = div(low+high, 2)
    IO.puts "Is it #{guess}?"
    _guess(actual, guess, range)
  end
  
  defp _guess(actual, guess, low..high) do
      cond  do
      guess == actual         -> IO.puts "Yes, it's #{actual}"
      guess < actual -> guess(actual, guess+1..high)
      guess > actual -> guess(actual, low..guess-1)
     
    end
  end
end
Chop.guess(271, 1..1000)

這個(gè)程式在邏輯上是等價(jià)的, 雖然一個(gè)是條件語(yǔ)句, 一個(gè)是pattern matching.

其實(shí)

  defp _guess(actual, actual, _),
    do: IO.puts "Yes, it's #{actual}"

  defp _guess(actual, guess, _low..high)
      when guess < actual,
    do: guess(actual, guess+1..high)

  defp _guess(actual, guess, low.._high)
      when guess > actual,
    do: guess(actual, low..guess-1)

它就是一個(gè)pattern matching, 只是你需要意識(shí)到把guess > actual, guess > actual, 以及其它任意情況(在這裏就只剩下相等啦)是作爲(wèi)match的條件而存在的.

你也可以自己改寫(xiě)成另一種pattern matching, 即case guess do形式, 這兩者是完全等價(jià)的, 只是看自己的品味, 窩寫(xiě)standard ml的時(shí)候更喜歡case哈.

可能你對(duì)pattern matching還不熟悉, 多寫(xiě)寫(xiě)就行啦, elixir的精華之一是pattern matching, 你以後可以儘可能的用patter matching, 有些時(shí)候會(huì)比較燒腦, 比起定義本地變量(典型的如sml中的let in)也可能會(huì)效率低些(因爲(wèi)很多情況會(huì)以無(wú)法使用尾遞歸爲(wèi)代價(jià)), 但是會(huì)非常簡(jiǎn)潔, 非常具有美感, 好好發(fā)現(xiàn)elixir的美吧, 掃年, functional programming的大門(mén)在等著你打開(kāi)

薔薇花 回答

去挑router.js里面自定義路由字段就好了

背叛者 回答

在網(wǎng)上查找了一番,發(fā)現(xiàn)一個(gè)Speak.js的js插件能實(shí)現(xiàn)將內(nèi)容識(shí)別成語(yǔ)音并播放出來(lái),鏈接為:http://www.5imoban.net/jiaoch...


由于沒(méi)有具體使用過(guò),只能在此給你一些在vue中使用第三方插件的一些建議:
1、將第三方文件放到static目錄下的文件中,例如放在/static/js
2、在main.js中引入(需要此插件支持import語(yǔ)法),import test from "/static/js/xxx.js"
3、注冊(cè)到vue原型上:Vue.prototype.$speak = test (這里的$speak可以自己取名)
4、在使用時(shí)通過(guò)this.$speak就可以拿到注冊(cè)到vue原型上的插件了

具體用法類似與我寫(xiě)過(guò)的一篇文章: Vue中配合clipboard.js實(shí)現(xiàn)點(diǎn)擊按鈕復(fù)制內(nèi)容到剪切板


希望我的回答對(duì)你有所幫助!
孤星 回答
UploadController負(fù)責(zé)后端接收?qǐng)D片文件并保存到項(xiàng)目的images路徑下

關(guān)鍵是僅僅存儲(chǔ)就可以了是吧?存儲(chǔ)完后要干啥么(比如做為資源給用戶訪問(wèn)?)?如果僅僅是存儲(chǔ),找個(gè)服務(wù)器的目錄存儲(chǔ)就行了吧

尛憇藌 回答

原因

永遠(yuǎn)無(wú)法執(zhí)行到的代碼就會(huì)這樣顯示

示例

const test = () => {
const a = 1;
return 2;
console.log(11);  //這一行也會(huì)出現(xiàn)你這種情況,因?yàn)樗肋h(yuǎn)無(wú)法執(zhí)行
}
孤酒 回答

圖片描述

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

你對(duì)圖片路徑做了說(shuō)明處理么?

筱饞貓 回答

在Linechart.js寫(xiě)props

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

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

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

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

孤巷 回答

根據(jù)《Effect Java》第二版總結(jié):
異常分為:

  1. 受檢異常(checked exception,你說(shuō)的編譯異常是指這個(gè)吧?)
  2. 運(yùn)行時(shí)異常(runtime exception)
  3. 錯(cuò)誤(error)

運(yùn)行時(shí)異常和錯(cuò)誤都是不需要也不應(yīng)該被捕獲的可拋出結(jié)構(gòu)。如果程序拋出運(yùn)行時(shí)異?;蛘咤e(cuò)誤,說(shuō)明出現(xiàn)了不可恢復(fù)的情形,繼續(xù)執(zhí)行下去有害無(wú)益。如果沒(méi)有捕捉到這樣的結(jié)構(gòu),將會(huì)導(dǎo)致當(dāng)前線程停止,并出現(xiàn)適當(dāng)?shù)腻e(cuò)誤消息。

使用原則:

  1. 如果期望調(diào)用者能夠適當(dāng)?shù)鼗謴?fù),對(duì)于這種情況就使用受檢的異常。
  2. 用運(yùn)行時(shí)異常來(lái)表明編程錯(cuò)誤。
  3. 如果不清楚是否有可能恢復(fù),則使用未受檢異常。
久不遇 回答

首先給你點(diǎn)個(gè)贊,8.0發(fā)布后還真沒(méi)注意到有這個(gè)新特性,剛?cè)ysql官網(wǎng)查了下,如下:

The .frm metadata files previously associated with base tables and views no longer exist. Metadata previously stored in .frm files is now stored in data dictionary tables.

Similarly, trigger metadata previously stored in .TRG and .TRN files is stored in a data dictionary table and those files no longer exist.

大概就是說(shuō).frm元數(shù)據(jù)文件已經(jīng)不存在了,現(xiàn)在被存儲(chǔ)在數(shù)據(jù)字典表中了。至于數(shù)據(jù)字典在哪,沒(méi)細(xì)看,應(yīng)該是在information_schema庫(kù)中,對(duì)比下表改動(dòng)還是很大的。
上面還給出一個(gè)信息.TRG觸發(fā)器文件也不存在了。
傳送門(mén)

神曲 回答

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

clipboard.png

苦妄 回答

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

注解本質(zhì)上就是一個(gè)接口,它的實(shí)質(zhì)定義為: interface SomeAnnotation extends Annotation。
這個(gè) Annotation 接口位于 java/lang/annotation 包,它的注釋中第一句話就是 The common interface extended by all annotation types.
-- 通過(guò)反射,動(dòng)態(tài)修改注解的某個(gè)屬性值
陌璃 回答

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

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 路由寫(xiě)法 (先導(dǎo)入基本的組件)

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

vue-router 寫(xiě)法

 {
      path: '/',
      redirect: '/index',
},
{ 
      path: '/index',
      name: 'index',
      component: home,
    
}