v-show 赞 踩 赞 踩 Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。
uni-app:第四章 网络接口和其他_uniapp 局域网接口
<template>
<view>
<view v-show="false">v-show</view>
<view v-if="true">v-if</view>
<view>xxx</view>
<button type="primary" @click="toPath">路由跳转</button>
<view>
<view>Vuex测试</view>
<view>{{num}}</view>
<button type="primary" @click="add">add方法</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
};
},
methods:{
toPath(){
uni.switchTab({
url:"../index/index"
})
},
add(){
this.$store.commit("add")
}
},
/**
* 计算
*/
computed:{
num(){
return this.$store.state.num;
}
},
onLoad: () => {
console.log("onLoad");
uni.request({
url: 'https://bird.ioliu.cn/weather', //仅为示例,并非真实接口地址。
data: {
city: '杭州'
},
header: {
'token': '123456'
},
success: (res) => {
console.log(res.data);
}
});
},
onReady() {
console.log("onReady");
console.log(this.$store.state.num)
},
onShow: () => {
console.log("onShow");
},
onHide: () => {
console.log("onHide");
},
onPullDownRefresh: () => {
console.log("onPullDownRefresh");
},
onReachBottom: () => {
console.log("onReachBottom");
},
onTabItemTap: () => {
console.log("点击 tab 时触发,参数为Object");
}
}
</script>
<style >
</style>