为什么刷新还是原来的this is content?

来源:2-4 Vue中的属性绑定和双向数据绑定

慕_JacksonLi

2019-08-27 22:14

为什么刷新还是原来的this is content?


是不是并没有改变data的content的值

写回答 关注

3回答

  • 纳兰嫣然
    2019-10-31 17:39:43

    <input type="text" id="textInput">
      输入:<span id="textSpan"></span>

    var obj = {},
            textInput = document.querySelector('#textInput'),
            textSpan = document.querySelector('#textSpan');

        Object.defineProperty(obj, 'foo', {
          set: function (newValue) {
            textInput.value = newValue;
            textSpan.innerHTML = newValue;
          }
        });

        textInput.addEventListener('keyup', function (e) {
            obj.foo = e.target.value;
        });

  • 慕神0442669
    2019-10-02 17:11:26

    是没有写v-model吧

    input的value值


  • 慕粉2466386
    2019-08-28 16:37:22

    我觉得你可以贴代码出来,没代码不知道哪里错?

vue2.5入门

快速理解Vue编程理念上手Vue2.0开发。

146122 学习 · 655 问题

查看课程

相似问题