<!DOCTYPE html>
<html lang="en"><head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<!-- 引入的目录结构按照 dist 文件夹下的目录结构引入 -->
<link rel="stylesheet" href="../sass/index.css">
</head>
<body>
<h1>首页</h1>
<div>123</div>
<script src="../lib/jquery/dist/jquery.min.js"></script>
<script>
// 2. 人家没有的数据
// 我们可以自己模拟一个
// 我决定号写这个网站了, 好多内容我都写完了
// 只是有一部分数据没有写, 因为没有, 这个时候换一个网站不合适
// 我们就自己模拟一个数据
// 你可以写成 一个数组直接放在这里
// var arr = [
// {
// name: 'A',
// id: 1,
// info: '我是一个信息'
// },
// {
// name: 'B',
// id: 2,
// info: '我是一个信息'
// }
// ]
// arr.forEach()
// 渲染页面
// **我们也可以写一个本地的 json 文件**
// 自己去请求本地的 json 文件
// 直接使用 ajax 请求本地的 json 文件
// $.ajax({
// url: '../lib/test.json',
// dataType: 'json',
// success: function (res) {
// console.log(res)
// }
// })
</script></body></html>
本地json数据的模拟
最新推荐文章于 2022-11-09 16:07:25 发布