I want to create basic sample of single file component in vue. I have configured webpack to compile my code and it works fine. Now i want to pass props to component and i get error that props is undefined.
index file
<head>
<meta charset="UTF-8">
<title>Vue Webpack Demo</title>
<script type="text/javascript" src="/dist/vue.js"></script>
</head>
<body>
<div id="mainContent">
<main-content post-title="hello!"></main-content>
</div>
</body>
<script src="/dist/index.js"></script>
index.js file
import Vue from 'vue';
import MainContent from './views/main-content';
let MainComponent = Vue.extend(MainContent);
new MainComponent().$mount("#mainContent");
main-content.vue
<template src="./main-content.html"></template>
<style scoped lang="scss" src="./main-content.scss"></style>
<script>
export default {
name: "main-content",
props: {
postTitle:{
type:String,
required:true
}
},
data: () => ({
webpack: 'Powered by webpack!?',
name:'name'
}),
}
</script>