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

鍍金池/ 問答/ HTML問答
練命 回答
  1. 定時(shí)向服務(wù)器拉,也就是使用ajax
  2. 服務(wù)器主動推送
  3. 使用websocket,服務(wù)器通知
柒喵 回答

axios post默認(rèn)參數(shù)格式為字符串,你可以用axios請求攔截器對post請求的參數(shù)做下處理

舊酒館 回答

無限循環(huán)啊 不要在模板里面改變數(shù)據(jù) 因?yàn)楦淖償?shù)據(jù)會更新模板
eventsList.reverse()改變了原數(shù)組eventsList ==> 觸發(fā)更新 ==> eventsList.reverse()==>觸發(fā)更新
可以用computed

<div class="eventItem" v-for="(item,index) in usersReverse" :key="index"></div>

computed: {
    usersReverse: function () {
      return this.users.reverse();
    }
  }
愚念 回答

webpack.base.conf.js


entry: {
    app: './src/main.js'
  }

.babelrc

     {
          "presets": [
            ["env", {
              "modules": false,
              "targets": {
                "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
              }
            }],
            "stage-2"
          ],
          "plugins": ["transform-vue-jsx", "transform-runtime","transform-decorators-legacy"]
        }
 

vue-shims.d.ts

 
 declare module "*.vue" {
      import Vue from 'vue';
      export default Vue;
    }

main.js文件不變

tsconfig.json

    
 {
  "compilerOptions": {
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "module": "es2015",
    "removeComments": true,
    "preserveConstEnums": true,
    "sourceMap": true,
    "strict": true,
    "target": "es5",
    "moduleResolution": "node",
    "lib": [
      "dom",
      "es5",
      "es2017",
      "es2015"
    ]
  }
}

App.vue

<template>
  <div>
    <input v-model="msg">
    <p>prop: {{propMessage}}</p>
    <p>msg: {{msg}}</p>
    <p>helloMsg: {{helloMsg}}</p>
    <p>computed msg: {{computedMsg}}</p>
    <button @click="greet">Greet</button>
  </div>
</template>

<script>
import Vue from 'vue'
import Component from 'vue-class-component'

@Component({
  props: {
    propMessage: String
  }
})
export default class App extends Vue {
  // initial data
  msg = 123

  // use prop values for initial data
  helloMsg = 'Hello, ' + this.propMessage

  // lifecycle hook
  mounted () {
    this.greet()
  }

  // computed
  get computedMsg () {
    return 'computed ' + this.msg
  }

  // method
  greet () {
    alert('greeting: ' + this.msg)
  }
}
</script>

<style>

#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}

</style>

package.json

"dependencies": {
    "awesome-typescript-loader": "^3.4.1",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "node-sass": "^4.7.2",
    "sass": "^1.0.0-beta.4",
    "sass-loader": "^6.0.6",
    "sass-resources-loader": "^1.3.1",
    "source-map-loader": "^0.2.3",
    "ts-loader": "^3.3.1",
    "typescript": "^2.6.2",
    "vue": "^2.5.2",
    "vue-class-component": "^6.1.2",
    "vue-router": "^3.0.1"
  },



https://github.com/yyccQQu/vu...

硬扛 回答
  1. 第一個setTimeout任務(wù)是在兩次遍歷以后才執(zhí)行的,一次times.map(getTime),一次之后的forEach,從結(jié)果看setTimeout(fn,0)是過了48ms才執(zhí)行的,基本是兩次遍歷的耗時(shí)。之后,每一個setTimeout任務(wù)執(zhí)行時(shí)都會觸發(fā)promise.then再執(zhí)行一段js,就是那段push數(shù)組和判斷打印的邏輯,promise.then的異步優(yōu)先級是要比setTimeout高的,下一個setTimeout要等上一個setTimeout的promise.then執(zhí)行完才會觸發(fā)執(zhí)行的。從結(jié)果看,后面每個setTimeout執(zhí)行的間隔都在10ms左右,基本是執(zhí)行promise.then的耗時(shí)。
  2. 后面兩個例子console.log(time)打印的都是傳入的參數(shù),是自己和自己比。
  3. Promise.all(times.map(getTime)).then(function(time) {console.log(time)})返回結(jié)果應(yīng)該是個數(shù)組,和times完全一致。
卟乖 回答
<el-form-item label="temp">
  <span slot="label">Label for the slot</span>
  <el-input v-model="formLabelAlign.name"></el-input>
</el-form-item>

https://stackoverflow.com/que...

不討囍 回答
// index.js
console.log(process.argv);

package.json

"build": "node index.js"
npm run build -- --name hello

打印的結(jié)果是

[ '/usr/local/bin/node',
  '/Users/ltaoo/Documents/nodejs/args/index.js',
  '--name',
  'hello' ]

參考

懷中人 回答

想要刷新子組件的評論?很簡單,評論是由數(shù)據(jù)顯示的,如果你數(shù)據(jù)變了自然評論也會變,
這樣你就可以在子組件watch會變的數(shù)據(jù)
如果你的數(shù)據(jù)是在子組件獲取到的,那么也可以在把獲取的方法寫在computed中,只要數(shù)據(jù)源變了同樣也會獲取

礙你眼 回答

async和await傳一個隱性Promise可以解決雙重回調(diào)問題

解夏 回答

有默認(rèn)顏色選項(xiàng)的,你這樣設(shè)置有報(bào)錯嗎?

陪她鬧 回答

canvas.selections=false//取消框選
object.set('selectable',false)//單個元素禁止選中

忘了我 回答

提供一個思路,給 + 按鈕添加點(diǎn)擊事件 更改 + 按鈕的背景顏色以及寬高 ,+ 按鈕的里面包裹著登錄框的信息,只不過通過alpha 隱藏了,然后點(diǎn)擊事件會讓登錄框信息顯示,然后最重要的是給 + 按鈕添加css的 transition 屬性就好了,我去寫一個試試

https://codepen.io/alexxxcs1/...

涼心人 回答

命令行移到單獨(dú)的包了,npm install -g webpack-cli

怣痛 回答

str === 'true'
或者
str === 'true' ? true : str === 'false' ? false : '我也不知道是什么鬼'

空痕 回答

Array.prototype.reduce 了解一下。

array.reduce((resp, obj)=> {
    var originObj = resp.find(item => item.key === obj.key);
    if (originObj) {
        originObj.value+= obj.value;
    } else {
        resp.push(obj)
    }
    return resp;
}, [])
心沉 回答

你的函數(shù)沒有返回值。

function debounceTrigger() {
  return debounce(function() {
    output2.value = (input2.value || '').toUpperCase();
  },
  500)
}
input2.addEventListener('input', debounceTrigger());