Vue 報錯Error: No PostCSS Config found問題及解決
Vue 報錯Error: No PostCSS Config found
從git上 clone 下來的代碼:
npm install
安裝依賴以后,啟動服務,出現Error: No PostCSS Config found報錯:
npm run dev
解決辦法
在項目根目錄下創(chuàng)建postcss.config.js,配置內容如下:即可修復報錯問題。
module.exports = { plugins: { 'autoprefixer': {browsers: 'last 5 version'} } }
Vue使用中報錯處理ERROR
Vue常見錯誤解析
vue.js:634 [Vue warn]: Do not mount Vue to <html> or <body> - mount to normal elements instead.
vue實例只能掛在到普通的元素標簽上,不能是html、body標簽,而且推薦使用id選擇器來獲取標簽
[Vue warn]: Property or method "XXX" is not defined on the instance but referenced during render.
vue框架是一個聲明式的框架,所以在掛載點內要使用變量時,要定義才能使用。
[Vue warn]: Unknown custom element: <mycom> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
組件的名字是否正確,或者檢查有沒有注冊
注意事項關于組件名稱:
vue.js:634 [Vue warn]: Do not use built-in or reserved HTML elements as component id: div
組件的名稱不能是html內置的標簽
組件的名稱不是html內置的標簽全大寫
如果組件的名稱包含大寫字母(非首字母),在使用組件時,要把大寫字母轉換成-小寫字母
vue.js:634 [Vue warn]: The "data" option should be a function that returns a per-instance value in component definitions.
因為對象類型的數據影響,組件復用時,數據會相互影響,所以為了保證數據的正確性和獨立性,在組件中定義data時,要寫成一個函數,并返回一個對象來定義組件的初始數據
以上為個人經驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關文章
基于Vue2-Calendar改進的日歷組件(含中文使用說明)
這篇文章主要介紹了基于Vue2-Calendar改進的日歷組件(含中文使用說明)的相關知識,非常不錯,具有一定的參考借鑒價值 ,需要的朋友可以參考下2019-04-04