I have hopefully a very easy question: I'd like to link components from within components in VueJS.
What I have so far:
create.js (which will be rendered with webpack to create.min.js)
var Vue = require('vue')
var App = require('./components/App.vue')
var Language = require('./components/Language.vue')
var vm = new Vue(App,'#app')
components/App.vue
<template>
<h1>Create!</h1>
<ss-lang></ss-lang>
<pre>
{{ $data | json }}
</pre>
</template>
<script>
module.exports = {
name : 'Create',
components : {
'ss-lang' : new Language()
}
}
</script>
components/Language.vue
<template>
<select v-model="selectedLanguage">
<option v-for="language in languages" v-bind:value="language.value">
{{ language.name }}
</option>
</select>
</template>
<script>
module.exports = {
name : 'Language',
data : function(){
return {
selectedLanguage : '',
languages : [
{value: 'be_en', name: 'English'},
{value: 'be_fr', name: 'Français'},
{value: 'be_de', name: 'Deutsch'},
{value: 'be_nl', name: 'Nederlands'},
{value: 'be_es', name: 'Español'}
]
}
}
}
</script>
When I open in the browser, I get the message that "Uncaught TypeError: Language is not a function". I was hoping that by connecting 'ss-lang' to the Language would be sufficient in connecting (as I added Language in the create.js).
What am I doing wrong? (eg which part of the documentation am I missing?)