- Full-Stack Vue.js 2 and Laravel 5
- Anthony Gore
- 138字
- 2021-07-02 19:57:18
Mock listing
While we're developing, it'd be nice to work with some mock data so that we can see how our completed page will look. I've included sample/data.js in the project for this very reason. Let's load it in our document, making sure it goes above ourapp.jsfile.
index.html:
<body> <p id="toolbar">...</p> <p id="app">...</p> <script src="node_modules/vue/dist/vue.js"></script> <script src="sample/data.js"></script> <script src="app.js"></script> </body>
Have a look at the file and you'll see that it declares a sample object. We will now utilize it in our data configuration.
app.js:
data: { title: sample.title, address: sample.address, about: sample.about }
Once you save and refresh, you'll see more realistic data on the page:

Figure 2.5. Page including mock-listing sample
Using global variables split over different script files in this way is not an ideal practice. We'll only be doing this in the prototype, though, and later we'll get this mock-listing sample from the server.
推薦閱讀
- Practical Internet of Things Security
- arc42 by Example
- Mastering Swift 2
- 網(wǎng)站構(gòu)建技術(shù)
- HTML 5與CSS 3權(quán)威指南(第3版·上冊(cè))
- Greenplum構(gòu)建實(shí)時(shí)數(shù)據(jù)倉(cāng)庫(kù)實(shí)踐
- 基于GPU加速的計(jì)算機(jī)視覺(jué)編程:使用OpenCV和CUDA實(shí)時(shí)處理復(fù)雜圖像數(shù)據(jù)
- Microsoft HoloLens By Example
- AutoCAD基礎(chǔ)教程
- MySQL數(shù)據(jù)庫(kù)應(yīng)用實(shí)戰(zhàn)教程(慕課版)
- 大規(guī)模語(yǔ)言模型開(kāi)發(fā)基礎(chǔ)與實(shí)踐
- JavaScript Concurrency
- Apache Solr for Indexing Data
- 新手學(xué)ASP.NET 3.5網(wǎng)絡(luò)開(kāi)發(fā)
- Mastering R for Quantitative Finance