更新登录组件,支持多种登录方式,修改版本号至0.1.1,并更新示例代码
This commit is contained in:
23
.cnb.yml
23
.cnb.yml
@@ -9,4 +9,25 @@ $:
|
||||
# 开发环境启动后会执行的任务
|
||||
# stages:
|
||||
# - name: pnpm install
|
||||
# script: pnpm install
|
||||
# script: pnpm install
|
||||
|
||||
main:
|
||||
web_trigger_sync_to_gitea:
|
||||
- services:
|
||||
- docker
|
||||
imports:
|
||||
- https://cnb.cool/kevisual/env/-/blob/main/env.yml
|
||||
stages:
|
||||
- name: 'show username'
|
||||
script: echo "GITEA_USERNAME is ${GITEA_USERNAME} and GITEA_PASSWORD is ${GITEA_PASSWORD}"
|
||||
- name: sync to gitea
|
||||
image: tencentcom/git-sync
|
||||
settings:
|
||||
target_url: https://git.xiongxiao.me/web-components/kv-login.git
|
||||
auth_type: https
|
||||
username: "oauth2"
|
||||
password: ${GITEA_TOKEN}
|
||||
git_user: "abearxiong"
|
||||
git_email: "xiongxiao@xiongxiao.me"
|
||||
sync_mode: rebase
|
||||
branch: main
|
||||
11
.cnb/web_trigger.yml
Normal file
11
.cnb/web_trigger.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
# .cnb/web_trigger.yml
|
||||
branch:
|
||||
# 如下按钮在分支名以 release 开头的分支详情页面显示
|
||||
- reg: "^main"
|
||||
buttons:
|
||||
- name: 同步代码到gitea
|
||||
desc: 同步代码到gitea
|
||||
event: web_trigger_sync_to_gitea
|
||||
- name: 同步gitea代码到当前仓库
|
||||
desc: 同步gitea代码到当前仓库
|
||||
event: web_trigger_sync_from_gitea
|
||||
@@ -74,8 +74,7 @@
|
||||
<div class="demo-container">
|
||||
<div class="login-section">
|
||||
<h2>登录组件</h2>
|
||||
<kv-login method="password">
|
||||
<div id="weixinLogin"></div>
|
||||
<kv-login method="password,wechat,wechat-mp">
|
||||
</kv-login>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@kevisual/kv-login",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"description": "",
|
||||
"main": "src/main.ts",
|
||||
"scripts": {
|
||||
@@ -19,6 +19,10 @@
|
||||
"access": "public"
|
||||
},
|
||||
"type": "module",
|
||||
"files": [
|
||||
"types",
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@kevisual/context": "^0.0.4",
|
||||
"@kevisual/query": "^0.0.32",
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
```html
|
||||
<kv-login>
|
||||
<div id="weixinLogin"></div>
|
||||
</kv-login>
|
||||
```
|
||||
|
||||
@@ -23,7 +22,6 @@
|
||||
<script type="module">
|
||||
import '@kevisual/kv-login';
|
||||
</script>
|
||||
<kv-login method="password">
|
||||
<div id="weixinLogin"></div>
|
||||
<kv-login method="password,wechat,wechat-mp">
|
||||
</kv-login>
|
||||
```
|
||||
|
||||
@@ -320,10 +320,18 @@ class KvLogin extends HTMLElement {
|
||||
return this.renderPasswordForm()
|
||||
}
|
||||
}
|
||||
|
||||
createWeixinEl(){
|
||||
const id = 'weixinLogin';
|
||||
let el = this.querySelector('#' + id);
|
||||
if (el) return el;
|
||||
const weixinEl = document.createElement('div');
|
||||
weixinEl.id = 'weixinLogin';
|
||||
this.appendChild(weixinEl);
|
||||
return weixinEl;
|
||||
}
|
||||
render() {
|
||||
if (!this.shadowRoot) return
|
||||
|
||||
this.createWeixinEl();
|
||||
const renderIcon = (icon: any) => {
|
||||
// 如果是emoji字符,直接返回
|
||||
if (typeof icon === 'string' && !icons[icon]) {
|
||||
|
||||
Reference in New Issue
Block a user