官术网_书友最值得收藏!

Setting up the project

For this project, we will have a few files ready to get us started:

  1. First, download simple-notebook project files and extract them in the same folder. Open the index.html file and add a p element with the notebook ID and a nested section element with the main class. You should have the following content inside the file:
      <html>
      <head>
        <title>Notebook</title>
        <!-- Icons & Stylesheets -->
        <link href="https://fonts.googleapis.com/icon?                   
family=Material+Icons" rel="stylesheet"> <link rel="stylesheet" href="style.css" /> </head> <body> <!-- Include the library in the page --> <script src="https://unpkg.com/vue/dist/vue.js"></script> <!-- Notebook app --> <p id="notebook"> <!-- Main pane --> <section class="main"> </section> </p> <!-- Some JavaScript --> <script src="script.js"></script> </body> </html>
  1. Now, open the script.js file to add some JavaScript. Just like you did in Chapter 1, Getting Started with Vue, create a Vue instance mounted on the #notebook element with a Vue constructor:
      // New VueJS instance
      new Vue({
        // CSS selector of the root DOM element
        el: '#notebook',
      })
  1. Then, add a data property called content that will hold the content of your note:
      new Vue({
        el: '#notebook',

        // Some data
        data () {
          return {
            content: 'This is a note.',
          }
        },
      })

Now you are ready to create your first real Vue app.

主站蜘蛛池模板: 临海市| 镇平县| 垦利县| 绥棱县| 武定县| 密山市| 文山县| 巴里| 青冈县| 阿坝县| 阿合奇县| 卢龙县| 兴化市| 龙岩市| 临湘市| 焦作市| 西峡县| 昭通市| 陵水| 湾仔区| 囊谦县| 寿阳县| 西吉县| 兰州市| 大埔县| 东乡县| 双柏县| 大埔县| 阿鲁科尔沁旗| 亳州市| 枣强县| 昆明市| 怀远县| 金昌市| 固阳县| 托里县| 含山县| 绥德县| 梨树县| 揭东县| 元氏县|