Last active
December 27, 2019 06:53
-
-
Save Summonshr/8a5d8334dc3bb4ea8ef67bbefe2132a3 to your computer and use it in GitHub Desktop.
Had hard time implementing vue styles so created my own.
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 component(name, url) { | |
let content = fs.readFileSync(url + '.vue', 'utf-8') | |
let element = document.createElement('body') | |
element.innerHTML = content | |
content = element.children[1].innerHTML.trim() | |
return Vue.component(name, { | |
template: element.children[0].innerHTML.trim(), | |
...eval('let module={};\n' + content) | |
}) | |
} | |
component('category-list', './components/category-list') | |
component('to-do', './components/to-do') | |
component('note-list', './components/note-list') | |
component('note', './components/content') |
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><span v-if="sidebar" v-html="moment().locale()"><span></div> | |
</template> | |
<script> | |
let moment = require('moment') | |
// Vital for module.exports | |
module.exports = { | |
methods: { | |
moment | |
}, | |
data() { | |
return { sidebar: false }; | |
} | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment