<template>
<div class="divTest" @click="clickNet2">
<text>Hello Weex!</text>
</div>
</template>
<script>
var modal = weex.requireModule('modal')
var stream = weex.requireModule('stream')
module.exports = {
data: {},
methods: {
clickNet:function (e) {
stream.fetch({
method: 'GET',
url: 'https://www.baidu.com/'
},function(res){
modal.toast({
message: res.data,
duration: 0.3
})
})
},
clickNet2:function (e) {
stream.fetch({
method: 'GET',
url: 'https://www.baidu.com/'
},res => {
modal.toast({
message: res.data,
duration: 0.9
})
})
}
}
}
</script>
<style>
.divTest {
align-items:center;
justify-content: center;
width: 750px;
height: 400px;
background-color: azure;
}
</style>
已经可以访问到网络返回的数据 了
image.png
网友评论