【发布时间】:2017-05-19 16:40:51
【问题描述】:
我有我的laravel 应用程序,我开始使用Vuejs。我是新手,也许我缺少一些核心概念。
无论如何(例如)我想使用这个component:具有搜索自动完成功能的多选。
我跑之后
npm install vue-multiselect@next --save
我的 node_module 中有组件目录,并且在 package.json 文件中也有依赖项 vue-multiselect。
现在我对如何在我的一个观点中前进和使用这个组件有点困惑。
网站安装无法正常工作。我无法在 common js 中使用 require 或 import 关键字。
基本用法
HTML
<multiselect v-model="value" :options="options">
JavaScript
import Multiselect from 'vue-multiselect'
// register globally
Vue.component(Multiselect)
export default {
// OR register locally
components: { Multiselect },
data () {
return {
value: null,
options: ['list', 'of', 'options']
}
}
}
安装和使用这个组件的正确方法是什么?
【问题讨论】:
标签: node.js laravel vue.js vue-component vuejs2