mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-02 03:57:36 +08:00
4f5a47d750
* fix root v-else not rendering in production and switched examples to minified vue for better prod coverage * add dev build comment to examples * convert tabs to spaces in todomvc example for consistency
40 lines
975 B
HTML
40 lines
975 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://unpkg.com/marked@0.3.6"></script>
|
|
<script src="https://unpkg.com/lodash@4.16.0"></script>
|
|
<!-- Delete ".min" for console warnings in development -->
|
|
<script src="../../dist/vue.min.js"></script>
|
|
</head>
|
|
<body>
|
|
|
|
<div id="editor">
|
|
<textarea :value="input" @input="update"></textarea>
|
|
<div v-html="compiledMarkdown"></div>
|
|
</div>
|
|
|
|
<script>
|
|
new Vue({
|
|
el: '#editor',
|
|
data: {
|
|
input: '# hello'
|
|
},
|
|
computed: {
|
|
compiledMarkdown: function () {
|
|
return marked(this.input, { sanitize: true })
|
|
}
|
|
},
|
|
methods: {
|
|
update: _.debounce(function (e) {
|
|
this.input = e.target.value
|
|
}, 300)
|
|
}
|
|
})
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|