-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set initial content #3
Comments
You can try to use |
<template>
<div class="block is-flex">
<brace style="height: 300px" v-html="jsonDetails" :mode="'json'">
</brace>
</div>
</template>
<script>
import Vue from 'vue'
import Brace from 'vue-bulma-brace'
export default {
components: {
Brace
},
data () {
return {
jsonDetails: ''
}
},
methods: {
openJson (event) {
var url = 'url to my api'
var self = this
this.$http.get(url).then(response => {
self.jsonDetails = JSON.stringify(response.body, null, 2)
}, response => {
console.log(String(response.body))
})
}
}
}
</script> @fundon can you tell us if it is possible at the moment? Looks like it lacks of method setValue like: setValue (value) {
editor.setValue(value)
} Thanks |
@marekkaczkowski I was having the same issue and this worked for me. <template>
<brace style="height: 500px; margin-left: 20px"
:fontsize="'22px'"
:theme="'monokai'"
:mode="'javascript'"
:codefolding="'markbegin'"
:softwrap="'free'"
:selectionstyle="'text'"
:highlightline="true">
</brace>
</template>
<script>
import Brace from 'vue-bulma-brace';
import * as brace from 'brace';
var editor
export default {
components: {
Brace
},
data() {
return {
events: []
}
},
mounted() {
this.$http.get('/event_schema').then(response => {
this.events = response.data
this.editor = brace.edit('vue-bulma-editor')
this.editor.session.setValue(JSON.stringify(this.events))
})
}
}
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey,
I'm trying to fill Brace with data that I receved from response
<brace>{{ jsonData }}</brace>
jsonData is defined in data container but then nothing happens. Works ok for regular textarea.Do I have to use Ace mechanism like
editor.setValue(jsonData)
?Thanks 😁
The text was updated successfully, but these errors were encountered: