|
@@ -25,7 +25,7 @@ Component({ |
|
@@ -25,7 +25,7 @@ Component({ |
|
25
|
observers: {
|
25
|
observers: {
|
|
26
|
'post': function(post) {
|
26
|
'post': function(post) {
|
|
27
|
this.setData({
|
27
|
this.setData({
|
|
28
|
- enclosure:JSON.parse(post.enclosure||null)
|
28
|
+ enclosure:this.isJSON(post.enclosure)
|
|
29
|
})
|
29
|
})
|
|
30
|
}
|
30
|
}
|
|
31
|
},
|
31
|
},
|
|
@@ -33,6 +33,14 @@ Component({ |
|
@@ -33,6 +33,14 @@ Component({ |
|
33
|
* 组件的方法列表
|
33
|
* 组件的方法列表
|
|
34
|
*/
|
34
|
*/
|
|
35
|
methods: {
|
35
|
methods: {
|
|
|
|
36
|
+ isJSON(str) {
|
|
|
|
37
|
+ try {
|
|
|
|
38
|
+ let data=JSON.parse(str);
|
|
|
|
39
|
+ return data;
|
|
|
|
40
|
+ } catch (e) {
|
|
|
|
41
|
+ return str;
|
|
|
|
42
|
+ }
|
|
|
|
43
|
+ },
|
|
36
|
displayImage(e){
|
44
|
displayImage(e){
|
|
37
|
let index=util.attr(e,'index')
|
45
|
let index=util.attr(e,'index')
|
|
38
|
if(this.data.enclosure[index].avinfo){//video
|
46
|
if(this.data.enclosure[index].avinfo){//video
|