Closed MARCUSW10 closed 8 years ago
试一下 http://localhost:8080 不要带 undefined
其实我不是这个意思,我打开时使用http://localhost:8080,但是当我点击图片时(图片有onclick函数),页面转到了http://localhost:8080/undefined,这就是问题所在
你在 <a>
标签里使用了 <image>
,点击图片时触发了链接跳转,但是你没指定 src
,所以就跳转到了 undefined
。
谢谢各位高手指点
我是按照http://www.jianshu.com/p/5d914fbac9ac将we集成到web的,但是打开localhost:8080出现了Cannot GET /undefined,本来想上传图片的,可是好像上传不了 代码是:
<template>
<wxc-item
style="border-width:15px;border-color:#63B8FF;" ><div
style="height:1160px;"><div
style="flex-direction:row;width:900px;height:600px;margin-top:100;" ><a>
<image
style="width:300px;height:300px;margin-top:50px;margin-left:25px;" src="{{List[num1].Photo}}" score="{{List[num1].score}}" onclick="clicked1" ></a>
<text
style="font-size:50px;left:13px;top:150px;">or<a>
<image
style="width:300px;height:300px;margin-top:50px;margin-left:30px;" src="{{List[num2].Photo}}" score="{{List[num2].score}}" onclick="clicked2" ></a>
</div>
</div>
</wxc-item>
</template>
<script>
require('weex-components');
module.exports={
data:{
num1:0,
num2:5,
count:0,
List: [ { id: 1, score:1000, canteen:1, Photo: 'https://gd2.alicdn.com/bao/uploaded/i2/TB1rtOnHpXXXXXLaXXXXXXXXXXX_!!0-item_pic.jpg_220x220.jpg', name:'', price:'2', areaname:'', rank:'', }, { id: 2, score:1000, canteen:1, Photo: 'https://gd2.alicdn.com/bao/uploaded/i2/TB1rtOnHpXXXXXLaXXXXXXXXXXX_!!0-item_pic.jpg_220x220.jpg', name:'', price:'3', areaname:'', nosize:70, rank:'', }, { id: 3, canteen:1, score:1000, Photo: 'https://gd2.alicdn.com/bao/uploaded/i2/TB1rtOnHpXXXXXLaXXXXXXXXXXX_!!0-item_pic.jpg_220x220.jpg', name:'', price:'4', areaname:'', nosize:70, rank:'', }, { id: 4, canteen:1, score:1000, Photo: 'https://gd2.alicdn.com/bao/uploaded/i2/TB1rtOnHpXXXXXLaXXXXXXXXXXX_!!0-item_pic.jpg_220x220.jpg', name:'', price:'4', areaname:'', nosize:70, rank:'', }, { id: 5, canteen:1, score:1000, Photo: 'https://gd4.alicdn.com/bao/uploaded/i4/TB15KrfFVXXXXXJXXXXXXXXXXXX_!!0-item_pic.jpg_220x220.jpg', name:'', price:'4', areaname:'', nosize:70, rank:'', }, { id: 6, canteen:1, rank:0, score:1000, Photo: 'https://gd4.alicdn.com/bao/uploaded/i4/TB15KrfFVXXXXXJXXXXXXXXXXXX_!!0-item_pic.jpg_220x220.jpg', name:'', price:'4', areaname:'', nosize:70, rank:'', }, { id: 7, canteen:3, score:1000, Photo: 'https://gd4.alicdn.com/bao/uploaded/i4/TB15KrfFVXXXXXJXXXXXXXXXXXX_!!0-item_pic.jpg_220x220.jpg', name:'', price:'16', areaname:'', nosize:70, rank:'', }, { id: 8, canteen:3, score:1000, Photo: 'https://gd4.alicdn.com/bao/uploaded/i4/TB15KrfFVXXXXXJXXXXXXXXXXXX_!!0-item_pic.jpg_220x220.jpg', name:'', price:'13', areaname:'', nosize:70, rank:'', }, { id: 9, canteen:3, score:1000, Photo: 'https://gd2.alicdn.com/bao/uploaded/i2/TB1rtOnHpXXXXXLaXXXXXXXXXXX_!!0-item_pic.jpg_220x220.jpg', name:'', price:'0', areaname:'', nosize:70, rank:'', }, { id: 10, canteen:2, score:1000, Photo: 'https://gd4.alicdn.com/bao/uploaded/i4/TB15KrfFVXXXXXJXXXXXXXXXXXX_!!0-item_pic.jpg_220x220.jpg', rank:'', }, ]}, methods:{ clicked1:function(){ var n=this.List[this.num2].score-this.List[this.num1].score; var ea=1/(1+10n/400); var eb=1/(1-10n/400); this.List[this.num1].score=this.List[this.num1].score+32(1-ea); this.List[this.num2].score=this.List[this.num2].score+32(0-eb);