npm install
npm run dev
npm run build
npm run test
npm run lint
npm run test:unit
Reason: webpack file loader 無法編譯動態地址。
Solution: 加上require('url')。
References: https://yuugou727.github.io/blog/2018/04/09/webpack-vue-dynamic-assets/
Reason: webpack-dev-server預設檢查hostname,若不在配置內,拋回錯誤。
Solution: vue.config.js設置disableHostCheck: true。
References: https://blog.csdn.net/renzhehongyi/article/details/80953319
Issue#3: Embed YouTube video - Refused to display in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'
Reason: Youtube watch endpoint 不允許外部訪問。
Solution: 將/watch?v=YOo001UM8PI改為/embed/YOo001UM8PI。
Reason: 在SPA的架構下,若是在index.html中引用Prismjs,他的highlight function只會偵測到當前DOM上的<code>tag,因此之後由js載入的component並不會有效果,需要重新整理。
Solution: 自定義component,在需要時引入並執行Prism.highlightElement()以達到程式碼著色效果。
References: https://prismjs.com/extending.html
Issue#5: 使用 Axios 接收到 Http Exception(EX: 500 Internal Server Error)後,進入 catch 中 console.log(err)結果為 js 的 error message,看不到後端傳回的自定義錯誤訊息。
Reason: console.log打印err的結果為string,看不到其中包含的response object。
Solution: console.log(err.response)便可以得到後端傳回的完整Http Exception object了。
References: axios/axios#960
Reason: ramen.imageSrc1被當成字串處理而不是變數。
Solution: :style="{ backgroundImage: 'url('+ ramen.imgSrc1 +')' }"。
References: https://stackoverflow.com/questions/35242272/vue-js-data-bind-style-backgroundimage-not-working
Reason: 子組件上的事件預設需要註冊在子組件的methods中。
Solution: 1.使用@click.native。 2.在子組件的methods中新增一個emit方法以觸發父組件的@click事件。
References: https://segmentfault.com/q/1010000011186651/a-1020000011187890
Reason: openssl與nodejs最新版本不相容。
Solution: 加入NODE_OPTIONS=--openssl-legacy-provider(可用cross-env套件: cross-env NODE_OPTIONS=--openssl-legacy-provider)
References: https://stackoverflow.com/questions/69394632/webpack-build-failing-with-err-ossl-evp-unsupported