l***@fuxiinstitution.org
l***@fuxiinstitution.org
  • 发布:2021-04-26 18:09
  • 更新:2021-04-26 18:09
  • 阅读:674

想调用安装的第三方库的方法,报错TypeError: Cannot read property 'login' of undefined

分类:uni-app

用npm安装了一个第三方library,script中已经引用了这个这个库,为什么调用里面的方法,点击跳转按钮报错,chunk-vendors.js:29712 [Vue warn]: Error in v-on handler: "TypeError: Cannot read property 'login' of undefined"

<template>  
    <view class="content">  
        <image class="logo" src="/static/logo.png"></image>  
        <view>  
            <text class="title">{{title}}</text>  
            <button type="default" @click="loginToInruptDotCom()">通过方法跳转到about页面</button>  
            <view>block</view>  
        </view>  
    </view>  
</template>  

<script>  
    //import dayjs from 'dayjs'  
    //import lzstring from 'lz-string'  
    import hhh from 'lodash'  
    import solidauthn from '@inrupt/solid-client-authn-browser'  

    export default {  
        data() {  
            return {  
                title: 'Hello'  
            }  
        },  
        onLoad() {  
            // console.log('----------------------')  
            // console.log('引入day.js框架,时间是'+dayjs.format())  
            // console.log('-----------------')  
            // var string = 'zifuchuansldadfjdfjalsdj'  
            // var compressed = lzstring.compress(string);  

            // console.log('压缩:'+compressed);  
            // string = lzstring.decompress(compressed);  

            // console.log('解压:'+string);  
            console.log('------------');  
            for(var i =0;i<6;i++){  
                console.log('load测试'+hhh.random(10,15));  
            };  

        },  
        methods: {  
            goto(url) {  
                            uni.navigateTo({  
                                url:url  
                            })  
                        },  
            test(){  
                console.log('hahahaha')  
            },  
            loginToInruptDotCom(){  
                return solidauthn.login({  

      oidcIssuer: "https://liwenjing.solid.fuxitechnology.cn/",  

      redirectUrl: window.location.href,  
    })  
            }  
        }  

    }  

</script>  

<style>  
    .content {  
        display: flex;  
        flex-direction: column;  
        align-items: center;  
        justify-content: center;  
    }  

    .logo {  
        height: 200rpx;  
        width: 200rpx;  
        margin: 200rpx auto 50rpx auto;  
    }  

    .text-area {  
        display: flex;  
        justify-content: center;  
    }  

    .title {  
        font-size: 36rpx;  
        color: #8f8f94;  
    }  
</style>  
2021-04-26 18:09 负责人:无 分享
已邀请:

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