Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vuejs2 VueJs中的反向阵列问题_Vuejs2_Vue.js - Fatal编程技术网

Vuejs2 VueJs中的反向阵列问题

Vuejs2 VueJs中的反向阵列问题,vuejs2,vue.js,Vuejs2,Vue.js,我通过facebook graph api获取对话消息,我需要反转数据 在computed reverseechat函数中,当我尝试JSON.parse(this.chat.data.reverse()或this.chat.data.reverse()显示错误时,我尝试返回this.chat.data但不返回() 控制台显示错误 [Vue warn]: Error when rendering anonymous component at C:\Users\PEM\Desktop\src\com

我通过facebook graph api获取对话消息,我需要反转数据


在computed reverseechat函数中,当我尝试
JSON.parse(this.chat.data.reverse()
this.chat.data.reverse()
显示错误时,我尝试返回
this.chat.data
但不返回()

控制台显示错误

[Vue warn]: Error when rendering anonymous component at C:\Users\PEM\Desktop\src\components\Chat.vue:
SyntaxError: Unexpected end of JSON input
    at json.parse (<anonymous>)
    at Proxy.render (eval at <anonymous> (app.js:2430), <anonymous>:123:85)
    at VueComponent.Vue._render (ever at <anonymous> (app.js:606), <anonymous>:2464:21)
    ...
工作。看



工作。参见

你所说的反向是什么意思?请花点时间更好地解释您的需求和问题,因为您似乎在尝试反转对象<代码>反向()需要在阵列上使用。你为什么要反向聊天?您是否正在尝试反转chat中的
数据
数组?您的chat属性中有一个json字符串。解析它,然后您可以访问数据属性
JSON.parse(this.chat).data.reverse()
。请看一看。(请更新您的问题,这样问题就清楚了,我将添加一个答案。)我的问题中添加了图片错误,我希望结果与您的链接一样反向,我尝试
JSON.parse(this.chat).data.reverse()
in.vue,但出现错误。您好!您是否可以编辑问题、删除链接图像并以文本形式粘贴在错误消息中?反向是什么意思?请花点时间更好地解释您的需求和问题,因为您似乎在尝试反转对象<代码>反向()需要在阵列上使用。你为什么要反向聊天?您是否正在尝试反转chat中的
数据
数组?您的chat属性中有一个json字符串。解析它,然后您可以访问数据属性
JSON.parse(this.chat).data.reverse()
。请看一看。(请更新您的问题,这样问题就清楚了,我将添加一个答案。)我的问题中添加了图片错误,我希望结果与您的链接一样反向,我尝试
JSON.parse(this.chat).data.reverse()
in.vue,但出现错误。您好!你能编辑问题、删除链接图像并将错误消息粘贴为文本吗?在jsfiddle中,但在file.vue中,我的项目错误我不知道为什么,因为它在计算时在
中没有数据?给
this.chat
一个默认值
{data:{}}
看看这是否有效。实际上,这个-
chat:{data:[]}
在计算的reverseChat函数中,我尝试返回
this.chat.data
在我尝试
JSON.parse(this.chat.data.reverse()
this.chat.data.reverse()时,返回
这个
显示错误。是否尝试执行
返回this.chat&&this.chat.data?jsfiddle中的.chat.data.reverse():“
中的
reversedChat()
有效,但在file.vue中我的项目错误我不知道为什么它在计算时在
中没有数据?给
this.chat
一个默认值
{data:{}}
看看这是否有效。实际上,这个-
chat:{data:[]}
在计算的reverseChat函数中,我尝试返回
this.chat.data
在我尝试
JSON.parse(this.chat.data.reverse()
this.chat.data.reverse()时,返回
这个
显示错误。是否尝试执行
返回this.chat&&this.chat.data?this.chat.data.reverse()
https://jsfiddle.net/pqrf2vu4/
JSON.parse(this.chat).data.reverse()