12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <template >
- <view>
- <u-tabbar v-model="myCurrent" :list="tabbarList"
- :before-switch="beforeSwitch"
- active-color="#1677ff"></u-tabbar>
-
- </view>
- </template>
- <script>
- import * as API from '@/apis/role.js'
-
- export default {
- name:"tabbarJob",
- props:{
- current: 0,
-
- },
- data() {
- return {
- tabbarList:API.getList(this.carhelp.getPersonInfo()),
- activeColor:"#5098FF",
- oldindex:0,
- myCurrent:0,
-
-
- };
-
- },computed:{
- currentNum(){
-
- for(var i in this.tabbarList){
- var item=this.tabbarList[i]
- if(item.current==this.current){
- return i;
- }
- }
- return -1;
- },
- },
- methods:{
- relist(){
- this.tabbarList=API.getList(this.carhelp.getPersonInfo());
- this.myCurrent=this.currentNum;
- },
- setcount(){
- // console.log("currentNum")
- // console.log(this.currentNum)
- this.myCurrent=this.currentNum;
- },
- beforeSwitch(index){
-
-
- if(index==this.currentNum){
- return false
- }
- var url =this.tabbarList[index].pagePath2;
-
- uni.navigateTo({
- url: url
- })
- if(index==1){
- this.myCurrent=this.oldindex;
- return false;
- }else{
- return true;
- }
-
- },
-
- },create(){
-
- }
- ,mounted(){
- console.log("mounted")
- this.myCurrent=this.currentNum;
- },destroyed(){
- }
-
- }
- </script>
- <style>
-
- </style>
|