javascript - 当我尝试从 themoviedb API 获取图像时出现奇怪的字符
问题描述
我必须展示一些电影图片,themoviedb api
但是当我尝试展示它们时,我只是有奇怪的角色
我试过用,atob()
但这个功能不起作用。
export default {
data() {
return {
info: null
};
},
mounted() {
axios
.get(
"https://image.tmdb.org/t/p/w500/8uO0gUM8aNqYLs1OsTBQiXu0fEv.jpg?
api_key=05b735a5f79822f887889281f45b295a"
)
.then(response => (this.info = response.data))
.then(response => console.log(this.info));
}
};
console.log(this.info) return to me this :
�����JFIF�����������
) )/'%'/9339GDG]]}
) )/'%'/9339GDG]]}����"����������������� �������� ����=��=��f��5�����@�����������&����Sv����u�
=thH�R]Z��ӫ|<L@����[�����4L�2�#�RT�uj�F�Ӈ���N�PB�����7���V�(��{;�
{3!Lt$M�SZSn�ͺ�٪�����=�����
Sͱ����PK��"hN�Р7�6�߷n���,�@���=˸:��������;;ez�Q��.co�1r��c��T^g��e�~Ū\Wՠ���M>����hGit�����P�����tt��A������cq��X���(���]�ѭ�/5\�����C*��bDu��}��5Z�������n��m��<�̵����LZ��1/�}��~5��Z�T�r��p�� P�Ϻ`��Pe��V���B�����G3���ϩ��a�/6>���
��>�j� .]�
��s�@���2>ڛ������o��GY������*v����F+�z�
ETC ...
谁能告诉为什么会这样。?
编辑:
url: null,
http: "https://image.tmdb.org/t/p/w300/",
key: "?api_key=05b735a5f79822f887889281f45b295a",
image: null,
name: ""
};
},
mounted() {
axios
.get(
"https://api.themoviedb.org/3/movie/popular?
api_key=05b735a5f79822f887889281f45b295a&language=en-US&page=1"
)
.then(response => (this.url =
response.data.results[0].poster_path))
.then(response => (this.image = this.http += this.url +=
this.key))
这东西行得通
解决方案
atob()
用于解码base64,但您提供的资源是图像而不是base64编码的图像。
你可以用html来展示它
<img src="https://image.tmdb.org/t/p/w500/8uO0gUM8aNqYLs1OsTBQiXu0fEv.jpg?api_key=05b735a5f79822f887889281f45b295a" alt="Fight Club">
推荐阅读
- php - 无法在 WordPress 中创建新帖子
- python - 如何重新缩放 matplotlib 直方图中的计数
- python - AxesSubplot 没有属性 xticks
- r - 在R中使用环视从字符串中提取匹配项
- java - Javafx 子级溢出 FlowPane
- c# - C# MongoDB 驱动程序 - 如何按数组和项目列表进行过滤
- android - 有没有更好的方法来处理仍然使用版本=27.0.2 的 Android 支持库的 Facebook Sdk?
- javafx - 选项卡创建事件处理程序
- java - 由于 NPE,恢复 Activity 时崩溃
- c# - materialdesigninxaml - 文本框验证文本与另一个文本框重叠