diff --git a/demo/App.vue b/demo/App.vue
index 22bf922..267a583 100644
--- a/demo/App.vue
+++ b/demo/App.vue
@@ -54,10 +54,17 @@
href="https://fonts.googleapis.com/css?family=Roboto+Mono"
rel="stylesheet"
/>
+
Separate use Editor and Preview with change event
+
@@ -97,4 +110,18 @@ body {
body .prism-editor__line-numbers {
box-sizing: border-box;
}
+
+.separate {
+ display: flex;
+ flex-direction: column;
+ width: 950px;
+ margin: 30px auto;
+}
+
+.preview-separate {
+ padding: 30px;
+ background-color: #fff;
+ text-align: center;
+ border-radius: 0 10px 10px 0;
+}
diff --git a/src/Editor.vue b/src/Editor.vue
new file mode 100644
index 0000000..0ec1199
--- /dev/null
+++ b/src/Editor.vue
@@ -0,0 +1,65 @@
+
+
+
+
+
diff --git a/src/Preview.vue b/src/Preview.vue
index 11a18f6..be56e5b 100644
--- a/src/Preview.vue
+++ b/src/Preview.vue
@@ -61,6 +61,11 @@ export default {
created() {
this.renderComponent(this.code.trim());
},
+ watch: {
+ code(value) {
+ this.renderComponent(value.trim());
+ }
+ },
methods: {
/**
* Generates the Scope Id attribute value. It will be added to each
diff --git a/src/VueLive.vue b/src/VueLive.vue
index c2eecbb..a7d92ea 100644
--- a/src/VueLive.vue
+++ b/src/VueLive.vue
@@ -9,11 +9,12 @@
:components="components"
>
-
@@ -29,15 +30,10 @@