原创 (轉載)vue中axios設置公共請求地址

先描述一下場景:vue項目,後臺請求地址在配置文件中已經設置爲全局的,每次變動只需修改一次即可,然後要部署到三臺服務器。 然後:修改服務器地址,打包,部署 --> 修改服務器地址,打包,部署 --> 修改服務器地址,打包,部署 (3次 "

原创 (原創) vue-element-admin 中使用 vuex 對 token 進行管理的解析

Vuex store 的狀態管理如下圖。     //普通定義的index.js import Vue from 'vue'; import Vuex from 'vuex'; import { dataService } from

原创 (原創) Javascript 中 await 和 async 的理解 : await 讓程序按字面順序執行

 await 讓代碼按字面順序執行! this.heroes = await data.getHeroes();   data.getHeroes() 會 return 一個 Promise 對象,如果直接寫 this.heroes =

原创 [轉載]onReachBottom 事件爲什麼不能觸發? (微信小程序)

如果頁面是自動生成的,下面還有一個onReachBottom事件會覆蓋掉上面自定義的事件。 參考如下:     https://developers.weixin.qq.com/community/develop/doc/000c60ff

原创 (原創) Rudex 中使用 Thunk 遇坑記(二) bounded function 一定要記得 destructure to props

Already bound dispatch to props const mapDispatchToProps = { loadCourses, loadAuthors, saveCourse, }; but forget

原创 (原創) Vue 中 Route 傳參和 props 的解析

先說正確的方法如下, 箭頭函數返回對象字面量,記住用params => {object:literal}這種簡單的語法返回對象字面量是行不通的。 https://developer.mozilla.org/zh-CN/docs/Web/J

原创 (原創) React 中使用Array.filter 遇坑記(一) filter 函數return Array

  useEffect(() => { // getCourses().then(_courses => setCourses(_courses)); getCourses().then(_courses => {

原创 [原創] Vuex 入坑記 (一)

1)  ...mapActions(['updateHeroAction', 'deleteHeroAction', 'addHeroAction']), 一定要放在 methods 下。錯誤的放在 computed 下找了半天才發現問題

原创 (轉載)vue-admin-template筆記(一)

文章目錄 Vue學習筆記(一) 初步印象 子模塊 main.js App.vue router 總結 參考 Vue學習筆記(一) 學習vue-admin-template https://github.com/PanJiaChen/vue

原创 (原創) JS擴展運算符 Spread syntax

參考資料: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax https://blog.csdn.net/q

原创 微信小程序支付異常:requestPayment:fail no permission (微信小程序)

先參考了這篇文章,但是我的appID原來也是正確的,點了修改再重新複製粘貼了一遍,就搞定了! https://www.cnblogs.com/han-1034683568/p/10330179.html 今天在調試微信小程序支付時碰到了這

原创 綁定並阻止事件冒泡 微信小程序

https://developers.weixin.qq.com/miniprogram/dev/framework/view/wxml/event.html   除 bind 外,也可以用 catch 來綁定事件。與 bind 不同, 

原创 (Forward) ['String'] to be function name, Javascript-Computed Property Names (ES6)

Unlike python dictionary, javascript objects need not have quotes around properties. var eatables = {fruit: 'Apple', v

原创 (轉載)axiosDELETE和PUT傳參方式

網上的回答都是以下這種: axios.delete({ url: 'http://localhost:3000/todos', data: { "id"

原创 (原創)子組件 props 屬性等價子組件的 data model

子組件 HeroDetail 有 props 屬性, 並在父組件 Heroes 中被使用 export default { name: 'HeroDetail', props: { hero: {