文章

顯示從 3月, 2023 起發佈的文章

i cant install vue-router by npm

 npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: vuejs-playlist@1.0.0 npm ERR! Found: vue@2.7.14 npm ERR! node_modules/vue npm ERR!   vue@"^2.5.11" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer vue@"^3.2.0" from vue-router@4.1.6 npm ERR! node_modules/vue-router npm ERR!   vue-router@"*" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm install vue-router@3

vue computed

  computed  計算屬性是基於它們的響應式依賴進行緩存的 methods會每次都行都執行一次functions computed的function中的variable如果沒有任何改變, 就只會return cache中的值, 不會重新 執行 . 你可能已經註意到我們可以通過在表達式中調用方法來達到同樣的效果: < p > Reversed message: "{{ reversedMessage() }}" </ p > // 在组件中 methods : { reversedMessage : function ( ) { return this . message . split ( '' ). reverse (). join ( '' ) } } 我們可以將同一函數定義為一個方法而不是一個計算屬性。 兩種方式的最終結果確實是完全相同的。 然而,不同的是 計算屬性是基於它們的響應式依賴進行緩存的 。 只在相關響應式依賴發生改變時它們才會重新求值。 這就意味著只要  message  還沒有發生改變,多次訪問  reversedMessage  計算屬性會立即返回之前的計算結果,而不必再次執行函數。

[SASS error] startbootstrap-sb-admin-2

 npm i startbootstrap-sb-admin-2

Error: Cannot find module 'webpack/lib/rules/DescriptionDataMatcherRulePlugin' Require stack:

npm update vue-loader