我在laravel 5.4项目中徘徊
问题是vue-masonry
(https://github.com/shershen08/vue-masonry)包不能处理以下错误
[Vue warn]: Failed to resolve directive: masonry
[Vue warn]: Failed to resolve directive: masonry-tile
请帮我检查一下我的设置是错误的部分。
这是我的app.js
:
require('./bootstrap');
require('masonry-layout');
require('imagesloaded');
require('fancybox');
var vueMasonry = require('vue-masonry');
Vue.use(vueMasonry);
bootstrap.js
仍然是原创而没有修改单词,
并且package.json
在这里:
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"bootstrap-sass": "^3.3.7",
"cross-env": "^3.2.3",
"laravel-mix": "0.*",
"lodash": "^4.17.4",
"minifier": "^0.8.1",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1"
},
"dependencies": {
"axios": "^0.15.3",
"fancybox": "^3.0.0",
"imagesloaded": "^4.1.3",
"jquery": "^3.1.1",
"masonry-layout": "^4.2.0",
"swiper": "^3.4.2",
"vue": "^2.1.10",
"vue-masonry": "^0.10.7"
}
}
最终的Html
类似于:
<div class="grid-wrap"
v-masonry
fit-width="true"
transition-duration="0.3s"
item-selector=".grid-item"
fit-width="true"
>
<div v-masonry-tile class="grid-item" v-for="wall in walls">
<div class="grid-date">
@{{ wall.created_at }}
</div>
</div>
</div>
答案 0 :(得分:0)
根据这个问题,包本身似乎已被打破
https://github.com/shershen08/vue-masonry/issues/26
只需向下滚动,您就会找到与您有相同问题的人,最新答案仅在13个小时前,所以我怀疑它已经修复了。