在vue-cli创建的项目中的单个文件组件中,我想导入vuestrap的一些组件:
import Vue from 'vue'
import alert from 'vue-strap/src/alert'
import dropdown from 'vue-strap/src/Dropdown'
export default {
name: 'todo',
components: {
alert, dropdown
},
data() {
return {
msg: '...'
}
}
}
如果我只导入警报,它的工作没有任何问题。但是,如果我导入Input
,Dropdown
,我会在vuestrap文件本身的vue文件中出现错误:
ERROR in ./~/vue-loader/lib/template-compiler.js?id=data-v-5f7de981!./~/vue-loader/lib/selector.js?type=template&index=0!./~/vue-strap/src/Dropdown.vue
Vue template syntax error:
v-else used on element <ul> without corresponding v-if.
@ ./~/vue-strap/src/Dropdown.vue 9:2-143
@ ./~/babel-loader/lib!./src/components/todolist/todolist.js
@ ./src/components/ToDo.vue
@ ./src/router/index.js
@ ./src/main.js
@ multi ./build/dev-client ./src/main.js
ERROR in ./~/vue-loader/lib/template-compiler.js?id=data-v-5f7de981!./~/vue-loader/lib/selector.js?type=template&index=0!./~/vue-strap/src/Dropdown.vue
Vue template syntax error:
class="btn btn-{{type}} dropdown-toggle": Interpolation inside attributes has been removed. Use v-bind or the colon shorthand instead. For example, instead of <div class="{{ val }}">, use <div :class="val">.
@ ./~/vue-strap/src/Dropdown.vue 9:2-143
@ ./~/babel-loader/lib!./src/components/todolist/todolist.js
@ ./src/components/ToDo.vue
@ ./src/router/index.js
@ ./src/main.js
@ multi ./build/dev-client ./src/main.js
对于某些组件,构建完全崩溃(例如Datepicker
)。
我的问题是:Vuestrap与Vue2不兼容,正如他们在documentation中所说的那样?或者我错过了什么?