【问题标题】:why the template ui did not show the vue data为什么模板ui没有显示vue数据
【发布时间】:2022-01-10 04:51:53
【问题描述】:

我是Vue的新手,现在我这样定义vue代码:

import Vue from "vue";

export default Vue.extend({
  data: () => {
    message: "show message";
  },
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<template>
  <div id="app">
    <div v-text="message"></div>
  </div>
</template>

为什么 UI 没有显示 Vue 数据message?这是我的沙盒版本代码:https://codesandbox.io/s/loving-sea-snvfj?file=/src/App.vue:149-237

【问题讨论】:

    标签: javascript vue.js


    【解决方案1】:

    我建议阅读官方网站上关于 Vue v2v3 的文档 - 非常好。 关于你的情况,最好先熟悉一下这些sections of the documentation

    以下是官网的例子:

    var app = new Vue({
      el: '#app',
      data: {
        message: 'show message'
      }
    })
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
    <div id="app">
      {{ message }}
    </div>

    【讨论】:

      猜你喜欢
      • 2022-10-16
      • 2020-11-08
      • 1970-01-01
      • 1970-01-01
      • 2021-06-21
      • 1970-01-01
      • 1970-01-01
      • 2020-05-21
      • 2015-10-16
      相关资源
      最近更新 更多