z***@gmail.com
z***@gmail.com
  • 发布:2020-03-25 10:53
  • 更新:2020-03-25 10:53
  • 阅读:687

微信小程序方法中传参报thirdScriptError

分类:uni-app
<template>  
    <view class="content">  
        <view class="list-tab">  
            <view class="list" @tap="switchTab(item.id)" :class="currid === item.id ? 'active' : ''" v-for="item in list" :key="item.id">  
                <text>{{ item.name }}</text>  
            </view>  
        </view>  
        <view class="panel">  
            <view class="menu-list-panel" v-for="item in list.filter(obj => obj.id === currid)[0].list" :key="item.id">  
                <text>{{item.name}}</text>  
                <view class="edit" @tap="edit(item.id)"><text>修改</text></view>  
            </view>  
        </view>  
    </view>  
</template>  

<script>  
export default {  
    data() {  
        return {  
            currid: 0,  
            list: [  
                {  
                    id: 0,  
                    name: '测试0',  
                    list: [  
                        {  
                            id: 0,  
                            name: "0"  
                        }  
                    ]  
                },  
                {  
                    id: 1,  
                    name: '测试1',  
                    list: [  
                        {  
                            id: 0,  
                            name: "1"  
                        }  
                    ]  
                }  
            ]  
        };  
    },  
    onLoad() {},  
    methods: {  
        switchTab(id){  
            this.currid = id;  
        },  
        edit(id){  
            console.log(id);  
        }  
    }  
};  
</script>  

<style lang="scss">  
.content {  
    display: flex;  
    align-items: center;  
    justify-content: center;  
    .list-tab {  
        display: flex;  
        flex-direction: column;  
        align-items: center;  
        justify-content: center;  
        margin-right: 40rpx;  
        .list{  
            &.active{  
                background-color: gold;  
            }  
        }  
    }  
}  
</style>  

以上是测试代码,点击修改后报错:

2020-03-25 10:53 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复