Created
August 6, 2019 09:24
-
-
Save taewo/2d07bc7b5604e0fd4a1873be8e7b3b0e to your computer and use it in GitHub Desktop.
에디터
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
// ====================== main.js | |
import Vue from 'vue' | |
import App from './App' | |
import router from './router' | |
// Import and use Vue Froala lib. | |
import VueFroala from 'vue-froala-wysiwyg' | |
import 'froala-editor/js/plugins.pkgd.min.js' | |
import 'froala-editor/css/froala_editor.pkgd.min.css' | |
Vue.use(VueFroala) | |
Vue.config.productionTip = false | |
/* eslint-disable no-new */ | |
new Vue({ | |
el: '#app', | |
router, | |
components: { App }, | |
template: '<App/>' | |
}) | |
// ====================== editor.vue | |
<template> | |
<div> | |
edit | |
<div id="app"> | |
<froala id="edit" :tag="'textarea'" v-model="model" :config="config"></froala> | |
</div> | |
<input @click="submit" type="button" value="submit"> | |
<div v-html="dom"> | |
</div> | |
</div> | |
</template> | |
<script> | |
import VueFroala from 'vue-froala-wysiwyg' | |
import FroalaEditor from 'froala-editor'; | |
export default { | |
name: 'Editor', | |
data () { | |
return { | |
config: { | |
events: { | |
initialized: function () { | |
console.log('initialized') | |
} | |
}, | |
placeholderText: 'Edit Your Content Here!!!', | |
}, | |
model: '', | |
dom: '' | |
} | |
}, | |
watch: { | |
model() { | |
console.log('--model--', this.model) | |
} | |
}, | |
methods: { | |
submit() { | |
console.log('submit') | |
this.dom = this.model | |
} | |
} | |
} | |
</script> | |
<style> | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment