<template>
<view>
<button type="primary" @click="chooseImg">上传图片</button>
<image v-for="item in imgArr" :src="item" @click="previewImg(item)"></image>
<navigator url="../content/content" open-type="switchTab">跳转</navigator>
<navigator url="../detail/detail" open-type="redirect">跳转</navigator>
<button @click="goDetail">跳转之信息页</button>
</view>
</template>
<script>
export default {
data() {
return {
imgArr:[]
}
},
methods: {
chooseImg(){
uni.chooseImage({
count:5,
success:res=>{
console.log(res)
this.imgArr=res.tempFilePaths
}
})
},
previewImg(current){
uni.previewImage({
current,
urls:this.imgArr,
loop:true
})
},
goDetail(){
uni.navigateTo({
url:'/pages/detail/detail'
})
}
}
}
</script>
<style>
</style>
运行结果