Skip to content

Commit 14aa13f

Browse files
committed
chore: update nuxt example, close F-loat#75
1 parent 3f453a9 commit 14aa13f

File tree

3 files changed

+66
-65
lines changed

3 files changed

+66
-65
lines changed

examples/index.vue

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -15,71 +15,71 @@
1515
</template>
1616

1717
<script>
18-
import VueSimplemde from 'vue-simplemde/src/vue-simplemde'
18+
import VueSimplemde from 'vue-simplemde';
1919
20-
// Base example
21-
export default {
22-
components: {
23-
VueSimplemde
24-
},
25-
data () {
26-
return {
27-
content: '',
28-
configs: {
29-
spellChecker: false // disable spell check
30-
}
31-
}
32-
}
33-
}
20+
// Base example
21+
export default {
22+
components: {
23+
VueSimplemde,
24+
},
25+
data() {
26+
return {
27+
content: '',
28+
configs: {
29+
spellChecker: false, // disable spell check
30+
},
31+
};
32+
},
33+
};
3434
35-
// Complete example
36-
export default {
37-
components: {
38-
VueSimplemde
39-
},
40-
data () {
41-
return {
42-
content: '',
43-
configs: {
44-
status: false, // disable the status bar at the bottom
45-
spellChecker: false // disable spell check
46-
}
47-
}
48-
},
49-
computed: {
50-
simplemde () {
51-
return this.$refs.markdownEditor.simplemde
52-
}
35+
// Complete example
36+
export default {
37+
components: {
38+
VueSimplemde,
39+
},
40+
data() {
41+
return {
42+
content: '',
43+
configs: {
44+
status: false, // disable the status bar at the bottom
45+
spellChecker: false, // disable spell check
46+
},
47+
};
48+
},
49+
computed: {
50+
simplemde() {
51+
return this.$refs.markdownEditor.simplemde;
5352
},
54-
mounted () {
55-
console.log(this.simplemde)
56-
this.simplemde.togglePreview()
53+
},
54+
mounted() {
55+
console.log(this.simplemde);
56+
this.simplemde.togglePreview();
5757
58-
// 'change' envent has bound, via @input attache an event listener
59-
// You can attache events in this [list](https://codemirror.net/doc/manual.html#events) yourself if necessary
60-
this.simplemde.codemirror.on('beforeChange', (instance, changeObj) => {
61-
// do some things
62-
})
58+
// 'change' envent has bound, via @input attache an event listener
59+
// You can attache events in this [list](https://codemirror.net/doc/manual.html#events) yourself if necessary
60+
this.simplemde.codemirror.on('beforeChange', (instance, changeObj) => {
61+
// do some things
62+
});
6363
64-
// remove SimpleMDE, when component destroy will invoke
65-
this.simplemde = null
64+
// remove SimpleMDE, when component destroy will invoke
65+
this.simplemde = null;
6666
67-
// some useful methods
68-
this.$refs.markdownEditor.initialize() // init
69-
this.simplemde.toTextArea()
70-
this.simplemde.isPreviewActive() // returns boolean
71-
this.simplemde.isSideBySideActive() // returns boolean
72-
this.simplemde.isFullscreenActive() // returns boolean
73-
this.simplemde.clearAutosavedValue() // no returned value
74-
this.simplemde.markdown(this.content) // returns parsed html
75-
this.simplemde.codemirror.refresh() // refresh codemirror
67+
// some useful methods
68+
this.$refs.markdownEditor.initialize(); // init
69+
this.simplemde.toTextArea();
70+
this.simplemde.isPreviewActive(); // returns boolean
71+
this.simplemde.isSideBySideActive(); // returns boolean
72+
this.simplemde.isFullscreenActive(); // returns boolean
73+
this.simplemde.clearAutosavedValue(); // no returned value
74+
this.simplemde.markdown(this.content); // returns parsed html
75+
this.simplemde.codemirror.refresh(); // refresh codemirror
76+
},
77+
methods: {
78+
handleInput() {
79+
// do some things
7680
},
77-
methods: {
78-
handleInput () {
79-
// do some things
80-
}
81-
}
82-
}
81+
},
82+
};
8383
</script>
8484

8585
<style>
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import Vue from 'vue'
2-
import VueSimplemde from 'vue-simplemde'
1+
import Vue from 'vue';
2+
import VueSimplemde from 'vue-simplemde';
3+
import 'simplemde/dist/simplemde.min.css';
34

4-
Vue.use(VueSimplemde)
5+
Vue.component('vue-simplemde', VueSimplemde);

examples/nuxt/nuxt.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
module.exports = {
22
// some nuxt config...
33
plugins: [
4-
{ src: '~plugins/nuxt-simplemde-plugin.js', ssr: false }
4+
{ src: '~plugins/nuxt-simplemde-plugin.js', ssr: false },
55
],
66
css: [
7-
'simplemde/dist/simplemde.min.css'
8-
]
9-
}
7+
'simplemde/dist/simplemde.min.css',
8+
],
9+
};

0 commit comments

Comments
 (0)