vue-markdown/App.vue

71 lines
1.7 KiB
Vue
Raw Normal View History

<template>
<div>
<Markdown
v-model="val"
@on-ready="onReady"
@on-copy="onCopy"
2019-12-13 18:21:59 +08:00
@on-upload-image="onUpladImage"
@on-save="onSave"
2019-12-13 18:28:20 +08:00
:height="fullHeight"
/>
</div>
</template>
<script>
// import Markdown from './dist/simple';
2019-11-08 17:57:24 +08:00
// import Markdown from 'vue-meditor';
import Markdown from './src/pro';
2019-12-13 17:32:17 +08:00
// import Markdown from './src/simple';
export default {
components: {
Markdown
},
2019-12-13 18:28:20 +08:00
mounted() {
const that = this
window.onresize = () => {
return (() => {
window.fullHeight = document.documentElement.clientHeight
that.fullHeight = window.fullHeight
})()
}
},
data: function () {
return {
2019-12-13 18:28:20 +08:00
val: '',
fullHeight: document.documentElement.clientHeight
}
},
2019-12-13 18:28:20 +08:00
watch: {
fullHeight(val) {
if (!this.timer) {
this.fullHeight = val
this.timer = true
let that = this
setTimeout(function() {
that.timer = false
}, 400)
}
}
},
methods: {
onReady(data) {
console.log(data)
},
onCopy(text) {
console.log(text);
},
2019-12-13 18:21:59 +08:00
onUpladImage(file) {
console.log(file)
},
onSave(data) {
console.log(data);
}
}
}
</script>
<style lang="less">
</style>