Vue&Axios Practice
Vue Practice
Axios
1. HTML Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords" content="">
<meta name="description" content="">
<title>The NYT API Demo</title>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/main.css">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div id="app" class="container">
<h3 class="text-center" >Vue News</h3>
<div class="row">
<div class="col-md-6">
<select id="" name="" v-model="section">
<option v-for="section in sections " :value="section" v-text="section"></option>
</select>
</div>
<div class="col-md-6">
<a class="btn btn-primary" @click="getPosts(section)">Chocie Category</a>
</div>
</div>
<news-list :results="results"></news-list>
</div>
<script src="https://cdn.bootcss.com/vue/2.4.2/vue.js"></script>
<script src="../bower_vendor/jquery/jquery.min.js"></script>
<script src="../bower_vendor/axios/dist/axios.min.js"></script>
<script src="./js/vue_fetchapi.js"></script>
</body>
</html>
展开阅读