使用vue的这个vue-select
组件https://github.com/sagalbot/vue-select
按照说明进行:
安装:
$ npm install sagalbot/vue-select
使用:
<template>
<div id="myApp">
<v-select :value.sync="selected" :options="options"></v-select>
</div>
</template>
<script>
import vSelect from '/node_modules/vue-select'
export default {
components: {vSelect},
data() {
return {
selected: null,
options: ['foo','bar','baz']
}
}
}
</script>
谷歌浏览器报错:
具体代码就是:
请大神帮解释一下怎么回事?
这种格式不能直接在浏览器跑,要用 webpack 或 browserify 预编译。
http://vuejs.org/guide/application.html#Single-File-Components