This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<GlobalEvents | |
@focus="handleAppFocus" | |
></GlobalEvents> | |
<!-- Component Contents --> | |
</div> | |
</template> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Register a global custom directive called `v-focus` | |
Vue.directive('focus', { | |
// When the bound element is inserted into the DOM... | |
inserted: function (el) { | |
// Focus the element | |
el.focus() | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
router.beforeEach((to, from, next) => { | |
document.title = to.meta.title | |
next() | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const routes = [ | |
{ | |
path: '/', | |
component: App, | |
meta: { | |
title: 'My Website- Homepage' | |
} | |
}, | |
{ | |
path: '/contact', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let node = { | |
tag: 'div' | |
attributes: { id: 'container' } | |
children: [ | |
// where the contained div would go | |
] | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id='container'> | |
<div id='baby'> | |
Hello | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function App() { | |
// Use "My Web App" if no child overrides this | |
return ( | |
<DocumentTitle title='My Web App'> | |
<SomeRouter /> | |
</DocumentTitle> | |
); | |
} | |
function HomePage() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul> | |
<li>Hello</li> | |
<li>World</li> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class List extends React.Component { | |
render() { | |
return ( | |
<ul> | |
<ListItem /> | |
</ul> | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul> | |
<div> | |
<li>Hello</li> | |
<li>World</li> | |
</div> | |
</ul> |