## Vue-resource获取数据
```
<!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">
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17-beta.0/vue.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue-resource/1.5.1/vue-resource.js"></script>
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
#movie {
width: 1200px;
margin: 30px auto auto auto;
}
li {
list-style-type: none;
float: left;
width: 200px;
margin: 20px;
}
img {
width: 100%;
height: 280px;
}
</style>
</head>
<body>
<div id="movie">
<ul>
<li v-for="item in list">
<img v-bind:src="item.image" alt="">
<p>{{ item.title }}</p>
</li>
</ul>
</div>
<script>
new Vue({
el: '#movie',
data: {
list: [
]
},
//创建之前
beforeCreate(){
var self = this;
// var url = 'https://douban.uieee.com/v2/movie/top250';
var url = 'https://douban.uieee.com/v2/movie/top250?start=0&count=40';
this.$http.jsonp(url).then(res=>{
// console.log(res);
let subjects = res.body.subjects;
console.log(subjects);
//element = subjects[index]
subjects.forEach(element => {
// console.log(element.title);
let title = element.title;
// console.log(element.images.small);
let image = element.images.small;
let temp = {};
temp.title = title;
temp.image = image;
// console.log(temp);
self.list.push(temp);
});
console.log(self.list);
})
}
})
</script>
</body>
</html>
```
- vs code 所需插件
- 新建项目基础配置
- 新项目初始化
- 项目打包上传
- 适配
- vue-vw
- vue-rem
- 基础
- 跳转
- 循环
- 样式
- 组件
- 子组件自定义事件向父组件传参
- 兄弟组件之间传参(含vuex)
- 实例:实现子组件word、list之间的参数传递
- 父子组件
- vuex的使用
- 精简版(不经过action)
- 组件实例(axios+http)
- axios读取网络数据
- MovieItem组件
- swiper
- better-scroll
- position:fixed搭配使用
- 数据绑定
- 计算属性
- 计算属性(computed)与监听属性(watch)搭配使用
- 侦听
- 动画
- 原理
- 使用iconfont
- 雪碧图
- 插槽
- @import引入外部样式
- 路径配置
- ref属性
- 显示隐藏的控制
- 生命周期
- 数据请求
- vuex
- 小效果
- 1.下滑顶部标题显示
- 2.在页面初始时加入动画效果
- 小项目
- Vue搜索功能
- Vue电影数据获取渲染
- Vue-travel
- main.js
- HTTP.js
- Head.vue
- swiper.js
- Home.vue
- 小技巧
- 1.阻止双击页面图片放大
- 2.缓存设置
- 3.跳转页面后从顶部开始显示
- 4.打包
- 5.使用store.js中的数据
- 使用库
- vant
- vant-list
- weex(实现vue代码编写Android软件)
- 1.启动项目
- 2.搭配Android studio
- vuex
- 1.State
- 2.Getter
- 3.Mutation
- 注
- 使用echarts
- echarts更换主题
