j***@outlook.com
j***@outlook.com
  • 发布:2022-11-26 11:20
  • 更新:2022-11-26 16:28
  • 阅读:799

云闪付 Error in onLoad hook: "ReferenceError: upsdk is not defined"

分类:uni-app

在根目录配置了
template.h5.html

<script src="https://open.95516.com/s/open/js/upsdk.js"></script>

为什么报
11:05:33.242 [Vue warn]: Error in onLoad hook: "ReferenceError: upsdk is not defined"

found in

---> at pages/home/home.vue
11:05:33.245 [system]ReferenceError: upsdk is not defined
at VueComponent.onLoad (webpack-internal:///yyVR:266:5)
at invokeWithErrorHandling (http://localhost:8085/static/js/chunk-vendors.js:3902:26)
at VueComponent.push.4UNb.Vue.__call_hook (http://localhost:8085/static/js/chunk-vendors.js:10650:17)
at r (http://localhost:8085/static/js/chunk-vendors.js:14538:376189)
at a (http://localhost:8085/static/js/chunk-vendors.js:14538:376767)
at VueComponent.created (http://localhost:8085/static/js/chunk-vendors.js:14538:9502)
at invokeWithErrorHandling (http://localhost:8085/static/js/chunk-vendors.js:3902:57)
at callHook (http://localhost:8085/static/js/chunk-vendors.js:6308:7)
at VueComponent.Vue._init (http://localhost:8085/static/js/chunk-vendors.js:7093:23)
at new VueComponent (http://localhost:8085/static/js/chunk-vendors.js:7239:12)

文档能不能说详细一点?

参考https://juejin.cn/post/7041097839711092744

云闪付开发者工具
https://open.unionpay.com/tjweb/doc/file/list?catType=02&relativeId=52
话说这个开发者工具为什么不放开放平台文档里?

2022-11-26 11:20 负责人:无 分享
已邀请:
j***@outlook.com

j***@outlook.com (作者)

好吧 要先在manifest.json中
Web配置index.html模版路径为template.h5.html

j***@outlook.com

j***@outlook.com (作者)

授权登录
UPButton
首先下载 vue-cup-ui.zip 包,下载地址 https://open.95516.com/s/open/components/vue-cup-ui.zip
然后将vue-cup-ui.common.js、vue-cup-ui.css放到某一个文件夹,我放到了lib文件夹
接着再main.js里引入
import VueCupUi from './libs/vue-cup-ui/vue-cup-ui.common.js';
import './libs/vue-cup-ui/vue-cup-ui.css';
Vue.use(VueCupUi);
最后在登录授权界面

<view>  
            <UPButton scope="scope.mobile,scope.auth" @click="UPButtonClick" class="UPButton">  
                云闪付用户一键登录  
            </UPButton>  
        </view>

如遇到TypeError: Cannot read property 'id' of null"
请参考https://ask.dcloud.net.cn/question/150397

目前我遇到的问题是
15:49:09.669 UPButtonClick err---》 undefined at pages/login/login.vue:61
15:49:09.670 UPButtonClick result---》 undefined at pages/login/login.vue:62
15:49:09.674 UPButtonClick event---》 [object] {"errcode":"ENV10001","errmsg":"检测到未在云闪付APP中运行或未成功加载upsdk.js"} at pages/login/login.vue:60

等待解答或者我踩坑

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