-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.vue
96 lines (88 loc) · 1.59 KB
/
App.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<template>
<div id="app">
<h1>
markdownEditor
</h1>
<markdown-editor
v-model="input"
:configs="configs"
>
</markdown-editor>
<h1>
codeEditor
</h1>
<code-editor
v-model="code"
:options="codeOpts">
</code-editor>
</div>
</template>
<script>
export default {
name: 'app',
data () {
return {
input:"# hello",
last:null,
code:"const a = 10",
editorOptions:{
tabSize:4,
lineNumbers:true,
mode:"markdown"
},
codeOpts:{
tabSize:4,
lineNumbers:true
},
configs:{
rmarkedOpts:{
image:true,
image_base:'http://rainboy.coding.me/rmarkedEditor/'
}
}
}
},
mounted(){
let self = this
$.get("test.md").then(function(data){
console.log("test.md loaded success!")
self.input= data
})
$.get("test.cpp").then(function(data){
console.log("test.cpp loaded success!")
self.code= data
})
},
methods:{
update(e){
let self = this
clearTimeout(self.last)
self.last = setTimeout(function(){
self.input = e.target.value
},500)
}
},
computed:{
compiledMarked(){
let self = this
return rmarked(self.input)
}
}
}
</script>
<style>
html,body,#app {
margin:0;
height:100%;
color:#333;
}
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
margin-top: 20px;
}
.markdown-body pre.hljs {
background:#002451;
}
</style>