【发布时间】:2016-11-22 14:28:54
【问题描述】:
更新:问题不会以“CDN”样式重现。这是完美运行的 JSBin:https://jsbin.com/ziqasifoli/edit?html,js,output
看起来它与 webpack/gulf/elixir/vuefy 中的某些东西相关联。即,所有 Laravel 5.3 基础设施。甚至不确定从哪里开始调试。
...
我正在努力使用一个简单的(如我所想的)组件,该组件将name、options 和selected 作为输入并显示多个选择框:
<!-- TagSelector.vue: -->
<template>
<select :name="name" v-model="selected" multiple>
<option v-for="option in options" v-bind:value="option.value">
{{ option.text }}
</option>
</select>
</template>
<script>
export default {
props: ['name', 'options', 'selected'],
}
</script>
.
// app.js
Vue.component('tags-selector', require('./components/form_fields/TagsSelector.vue'));
const app = new Vue({
el: '#app'
});
.
<!-- some.form.blade.php -->
<tags-selector
class="form-control"
name="posted_data[tags]"
:selected="['opt1', 'opt2']"
:options='{!! json_encode($options) !!}'
></tags-selector>
它按预期显示选择器,但没有预先选择的选项。 如何让它工作?
【问题讨论】:
-
请提供 JSBin 或类似的。
-
jsbin.com/ziqasifoli/edit?html,js,output 在这里我不使用模块和/或 vuefy 之类的东西,它实际上运行良好。所以,现在需要弄清楚“laravel 风格”的 vuefying 有什么问题......
标签: laravel gulp elixir vue.js