vue-swipe
vue-swipe copied to clipboard
Failed to resolve directive: el (found in component <mt-swipe>)
`require('vue-swipe/dist/vue-swipe.css')
import { Swipe, SwipeItem } from 'vue-swipe'
export default ({ components: { 'swipe': Swipe, 'swipe-item': SwipeItem } })`
<template> <swipe class="my-swipe"> <swipe-item class="slide1">Slide1</swipe-item> <swipe-item class="slide2">Slide2</swipe-item> <swipe-item class="slide3">Slide3</swipe-item> </swipe> </template>
This code use to work with versions of Vue 2.0
+1
+1 _h is not defined
+1
use [email protected] = =!!
我自己解决了,版本的问题 "vue": "2.1.3", "vue-template-compiler":"2.1.3", "vue-loader": "10.0.0", 固定装这几个版本,就不会出问题了,执行下面的命令
sudo rm -rf node_modules sudo npm cache clean sudo npm install
很纳闷,按照@SidFeng的办法固定版本的确能解决问题。但是一开始我的swipe加载了,只是width的全值太低了被重置了。导致没有宽度无法显现,最后手动写入!important才解决 。不知道为什么 ~
+1 downgrading to [email protected] works, but this should work with latest stable build too
"vue","vue-template-compiler"这两个库版本一样就行。