美文网首页
Vue 01怎么使用

Vue 01怎么使用

作者: 昵称啦啦啦 | 来源:发表于2018-12-05 16:18 被阅读0次

怎么使用VUE

步骤

  • 使用步骤
  • 1:引包,具备vue对象
  • 2:启动vue 通过 new Vue(options);
  • 3:配置options对象
  • 4:参数:el: '目的地' template: '模板' data: function () {return { '要使用的key : 数据' }}
  • 5:页面中存在该目的地,同jq语法

代码

  <div id="app"></div>
  <!-- 引包 vue.js有报错信息 vue.min.js压缩后的没有报错信息-->
  <script src="./node_modules/vue/dist/vue.js"></script>
  <script>
    new Vue({
      // el: 发生行为的目的地
      // el: document.getElementById('app');
      el: '#app',
      // template: 装载的模板
      template: '<div><h1>大家好 {{text}}</h1></div>',
      // 动态数据的声明
      data: function() {
        return {
          // template 中需要的数据
          text: 'hello vue',
        }
      }
    })

相关文章

网友评论

      本文标题:Vue 01怎么使用

      本文链接:https://www.haomeiwen.com/subject/ktdwcqtx.html