1.0.0 • Published 2 years ago
uwell-dd-auth v1.0.0
uwell-dd-auth
Vue3.0 钉钉授权组件,支持 vite、webpack 构建的 vue 项目
安装
npm
npm install uwell-dd-auth
Yarn
yarn add uwell-dd-auth
pnpm
pnpm install uwell-dd-auth
组件参数说明
参数 | 说明 | 类型 | 是否必填 |
---|---|---|---|
url | 发起请求授权的 url | String | 是 |
corpId | 企业 id | String | 是 |
openPath | 跳转到外部的 path | String | 否 |
userId | 开发时所用的 id | String | 否 |
isOutSide | 是否跳转外部浏览器访问应用 | Boolean | 否 |
isPcOnly | 是否只允许 pc 端访问 | Boolean | 否 |
isMbOnly | 是否只允许移动端访问 | Boolean | 否 |
组件使用示例
<template>
<div class="wrap">
<vue-dd-auth corpId="xxx" url="xxx" @change="handleChange"> </vue-dd-auth>
</div>
</template>
<script setup>
import { VueDdAuth, setCookie } from "uwell-dd-auth";
const handleChange = (val) => {
// 回调, 在此处写你需要的逻辑即可
console.log(val);
// 如果想用cookie存储相关信息可直接引入组件内部cookie方法, 如下使用
setCookie(xx, xx, xx);
};
</script>
<style scoped>
.wrap {
width: 100%;
height: 100%;
}
</style>
- 内置 cookie 方法使用
<script setup>
import { setCookie, getCookie, delCookie } from "uwell-dd-auth";
setCookie("name", "value", 1); // 名称、内容、有效时间
getCookie("name");
delCookie("name");
</script>