Skip to content
This repository was archived by the owner on May 3, 2018. It is now read-only.
This repository was archived by the owner on May 3, 2018. It is now read-only.

I want bind pre-rendered html text #56

@suisho

Description

@suisho

Hi.
I try bind (in other word attahced) vue vm object with rendered from server.

And I can't this with v-text directive, but v-text override value.

<div id="bar" >
  <div v-text="baz" v-on="click:changeBaz">
    Some text Baz
  </div>
</div>
<script>
  var useText = new Vue({
    el : "#bar"
  })
  console.log(useText.baz) // output undefined. This is NOT my wanted behavor
</script>

Secondly, I found solution thatn use v-model.
But in document, I may should not use v-model with div.

<div id="foo" >
  <div v-model="baz" v-on="click:changeBaz">
    Some text Foo
  </div>
</div>
<script>
  var useModel = new Vue({
    el : "#foo"
  })
  console.log(useModel.baz.trim() == "Some text Foo") // true. This is my wanted behavor
</script>

Can you tell me good solution?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions