vuejs / vue

This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
http://v2.vuejs.org
MIT License
207.71k stars 33.67k forks source link

uikit html editor not displaying text when data is retrieved dynamically using vue-resource #1815

Closed kamal-chagam closed 8 years ago

kamal-chagam commented 8 years ago

i'm using trying to use uikit htmleditor , which displays data retrived dynamically

html code

<textarea data-uk-htmleditor="{markdown:true,mode:'tab'}">{{hotel.description}}</textarea>

<!--  this is working if hard coded  property is used  -->
<textarea data-uk-htmleditor="{markdown:true,mode:'tab'}">{{description}}</textarea>

vuejs **

export default {
  data () {
    return {
      is_edit:false,
      description:"This is hardcoded value",
      hotel: {}
    }
  },

  route: {
    data ({ to }) {
      return {
        hotel:this.details(to.params.slug) 
      }
    }
  },

  methods:{
     details (slug) {
        this.$http.get('/admin/hotels/' + slug)
                .success(function(hotel) {
                    this.hotel = hotel;
                }).error(function (error) {
                    alert("error")
                });
     }
  }

what i am doing woring?

atinux commented 8 years ago

Hi @chagamkamalakar

Can you post your issue on the Vue.js forum please? A lot of people of there to help you on that :) http://forum.vuejs.org/category/5/help

This way, @yyx990803 can focus only on bugs and suggestions on vue.js here.

Thank you

kamal-chagam commented 8 years ago

sorry .. for that ... i sorted out this issue by keeping this code

 $.UIkit.htmleditor('#description', { /* options */ });
var editor = $('.CodeMirror')[0].CodeMirror;
editor.setValue(this.hotel.description);

thanks for your suggestion .. i'll use only vuejs forum

atinux commented 8 years ago

I see @chagamkamalakar, you should post it on vue.js forum anyway because I think there's maybe a better solution for this issue (like using a directive).