【发布时间】:2021-03-11 14:40:41
【问题描述】:
我在普通 JS 中有以下代码,我想将其转换为 vuejs。
HTML:
<div id="ndi"></div>
JS:
const initAuthSessionResponse = window.NDI.initAuthSession(
"ndi",
{
clientId: "abcd1234", // Replace with your client ID
redirectUri: "https://primuslogin.firebaseapp.com/callback/", // Replace with a registered redirect URI
scope: "openid",
responseType: "code"
},
authParamsSupplier,
onError
);
在 vuejs 中我是这样做的,但不知何故它不起作用。
<div ref="ndi"></div>
window.NDI.initAuthSession(
this.$refs.ndi,
{
clientId: "abcd1234", // Replace with your client ID
redirectUri: "https://primuslogin.firebaseapp.com/callback/", // Replace with a registered redirect URI
scope: "openid",
responseType: "code"
},
{ state: "abc", nonce: "def" },
this.onError
);
我想知道如何将 div 中的 id 转换为通常使用 ref 完成的 vuejs 样式。任何帮助将不胜感激。
这是整个 vuejs 版本: https://gist.github.com/somaria/e965264060502a3c1554953487c7dcff
这是正常的js版本: https://gist.github.com/somaria/e965264060502a3c1554953487c7dcff
普通的 js 版本运行良好,但我想将其转换为 vuejs。
【问题讨论】:
标签: javascript vue.js nuxtjs