【问题标题】:how to solve problem with vuejs not detected如何解决未检测到 vuejs 的问题
【发布时间】:2020-10-07 13:23:58
【问题描述】:

quand j'execute index.html j obtient {{name}} toujours vuejs est nondetecté

<html>
  <head>
    <meta charset="UTF-8" />
    
    <title>learn vuejs</title>
    <link rel="shortcut icon" href="#" />
  </head>
  <body>
    
    <div id="j">{{ name }}</div>
    <script src="js/vue.min.js"></script>
    <script >
new Vue({
  ele: "#j",
  data: {
    name: "welcome to vue",
  },
});</script>
  </body>

【问题讨论】:

标签: javascript html vue.js


【解决方案1】:

刚刚使用了这段代码:

new Vue({
  el: "#j",
  data: {
    name: "welcome to vue",
  },
})

不要使用ele,只需使用el

【讨论】:

  • 我很高兴听到这个消息
【解决方案2】:

你可以设置一个事件监听器:

document.addEventListener('DOMContentLoaded', function () {
  new Vue({
    el: '#j',
    // define data - initial display text
    data: {
      name: "welcome to vue",
    }
  })
})

【讨论】:

    猜你喜欢
    • 2018-12-11
    • 1970-01-01
    • 2014-07-12
    • 1970-01-01
    • 2021-12-26
    • 2013-11-19
    • 1970-01-01
    • 2020-08-19
    • 1970-01-01
    相关资源
    最近更新 更多