1
我無法使用vue-truncate-filter npm包。我安裝了它使用命令行使用此命令:vue-truncate-filter沒有篩選和拋出錯誤
npm install vue-truncate-filter --save
但是我看到了以下錯誤:
[Vue warn]: Failed to resolve filter: truncate 30 '....'
這裏是我的模板:
<div v-show="wbwState[index]" v-bind:style="{ margin:`0 ${8}px ${8}px ${8}px`, color: '#C10E40' }">{{ word.english | truncate 5 '....' }}</div>
和:
<div class="eng">{{ word.english | truncate 5 '....' }}</div>
在main.js中我有:
const VueTruncate = require('vue-truncate-filter');
Vue.use(VueTruncate)
我也嘗試在實際組件本身使用Vue.use()
。任何人都可以看到我做錯了什麼?謝謝!