import Hello from '@/components/Hello'
in this case @ resolves to "src" due to this webpack configuration
const routes = [
{
path: "/my-big-page",
name: "my-big-page",
component: () => import('@pages/MyBigPage.vue')
}
]
import MyComponent from './components/MyComponent.vue'
Vue.component('my-component', MyComponent)
<component :is="layout">
<router-view/>
</component>
<script>
export default {
computed : {
layout(){ return 'component-name'}
}
}
</script>
<keep-alive>
<your-component/>
</keep-alive>
<span v-bind:title="message">
...
data: {
message: 'You loaded this page on ' + new Date().toLocaleString()
}
<span v-if="seen">Now you see me</span>
...
data: {
seen: true
}
<li v-for="todo in todos">
{{ todo.text }}
</li>
...
data: {
todos: [
{ text: 'Learn JavaScript' },
{ text: 'Learn Vue' },
{ text: 'Build something awesome' }
]
}
<button v-on:click="reverseMessage">Reverse Message</button>
...
methods: {
reverseMessage: function () {
this.message = this.message.split('').reverse().join('')
}
}
<input v-model="message">
...
data: {
message: 'Hello Vue!'
}
Vue.component('todo-item', {
template: '<li>This is a todo</li>'
})
- data properties is automatically added by vie to reactive system
- only those property that is added when creating the vue instance is added
- you can prevent changes on the data by having Object.freeze
- $data - the data object
- $el - the root element where vue is mounted on
- $options - options used when instantiating
see more
- created
- mounted
- updated
- destroyed
<span v-html="rawHtml"></span>