- Vue.js 2 Web Development Projects
- Guillaume Chau
- 158字
- 2021-07-02 22:34:25
Setting up the project
For this project, we will have a few files ready to get us started:
- 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>
- 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', })
- 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.
推薦閱讀
- UML和模式應(yīng)用(原書第3版)
- Java 開發(fā)從入門到精通(第2版)
- Java 9 Concurrency Cookbook(Second Edition)
- Offer來(lái)了:Java面試核心知識(shí)點(diǎn)精講(原理篇)
- 新手學(xué)Visual C# 2008程序設(shè)計(jì)
- 教孩子學(xué)編程:C++入門圖解
- AIRIOT物聯(lián)網(wǎng)平臺(tái)開發(fā)框架應(yīng)用與實(shí)戰(zhàn)
- 硬件產(chǎn)品設(shè)計(jì)與開發(fā):從原型到交付
- Kotlin Programming By Example
- WildFly Cookbook
- Angular Design Patterns
- 軟件測(cè)試技術(shù)
- 前端程序員面試算法寶典
- 程序員超強(qiáng)大腦
- 面向?qū)ο蟪绦蛟O(shè)計(jì)教程(C#版)