vue/examples/markdown/index.html
2016-04-16 02:44:48 -04:00

35 lines
830 B
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Vue.js markdown editor example</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.jsdelivr.net/marked/0.3.5/marked.min.js"></script>
<script src="https://cdn.jsdelivr.net/lodash/4.11.1/lodash.min.js"></script>
<script src="../../dist/vue.js"></script>
</head>
<body>
<div id="editor">
<textarea :value="input" @input="update"></textarea>
<div v-html="marked(input)"></div>
</div>
<script>
new Vue({
el: '#editor',
data: {
input: '# hello'
},
methods: {
marked: marked,
update: _.debounce(function (e) {
this.input = e.target.value
}, 300)
}
})
</script>
</body>
</html>