You've already forked pure-component
修复 下拉框属性设置问题;
修复 对话框属性设置问题; 修复 模态框属性设置问题;
This commit is contained in:
@@ -401,7 +401,7 @@
|
|||||||
<p class="component-description">用于内容分组和导航,支持描述文本和自定义高亮颜色。</p>
|
<p class="component-description">用于内容分组和导航,支持描述文本和自定义高亮颜色。</p>
|
||||||
|
|
||||||
<div class="component-demo">
|
<div class="component-demo">
|
||||||
<ui-tab id="demoTab" list="基本信息>个人资料|安全设置>账户安全|通知>消息提醒"></ui-tab>
|
<ui-tab id="demoTab" list="基本>个人资料|通知>消息提醒"></ui-tab>
|
||||||
<div id="tabContent" style="padding: 15px; text-align: center"> 选项卡内容区域 </div>
|
<div id="tabContent" style="padding: 15px; text-align: center"> 选项卡内容区域 </div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -522,7 +522,7 @@
|
|||||||
|
|
||||||
// 选项卡切换事件
|
// 选项卡切换事件
|
||||||
document.getElementById('demoTab').addEventListener('change', function (e) {
|
document.getElementById('demoTab').addEventListener('change', function (e) {
|
||||||
document.getElementById('tabContent').innerText = `切换到: ${e.detail.innerText}`
|
document.getElementById('tabContent').innerText = e.detail.innerText
|
||||||
})
|
})
|
||||||
|
|
||||||
// 搜索框事件
|
// 搜索框事件
|
||||||
|
30
index.js
30
index.js
@@ -424,9 +424,9 @@ class UI {
|
|||||||
this.ele.querySelector('.select-button').removeAttribute('disabled')
|
this.ele.querySelector('.select-button').removeAttribute('disabled')
|
||||||
}
|
}
|
||||||
} else if (name == 'value') {
|
} else if (name == 'value') {
|
||||||
this.dl.innerHTML = ''
|
if (this.dl) this.dl.innerHTML = ''
|
||||||
this.addOption()
|
this.addOption()
|
||||||
this.button.innerText = this.placeholder || this.options[this.current].text
|
if (this.button) this.button.innerText = this.placeholder || this.options[this.current].text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 重置
|
// 重置
|
||||||
@@ -446,7 +446,7 @@ class UI {
|
|||||||
const options = list.split(',')
|
const options = list.split(',')
|
||||||
const optionValues = value.split(',')
|
const optionValues = value.split(',')
|
||||||
|
|
||||||
this.dl.innerHTML = ''
|
if (this.dl) this.dl.innerHTML = ''
|
||||||
|
|
||||||
// 添加选项
|
// 添加选项
|
||||||
options.forEach((item, index) => {
|
options.forEach((item, index) => {
|
||||||
@@ -458,7 +458,7 @@ class UI {
|
|||||||
dd.classList.add('selected')
|
dd.classList.add('selected')
|
||||||
}
|
}
|
||||||
this.options.push({ text: item, value: optionValues[index] })
|
this.options.push({ text: item, value: optionValues[index] })
|
||||||
this.dl.appendChild(dd)
|
if (this.dl) this.dl.appendChild(dd)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 初始化
|
// 初始化
|
||||||
@@ -928,10 +928,12 @@ class UI {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO:对话框
|
// 对话框
|
||||||
this.Dialog = class Dialog extends HTMLElement {
|
this.Dialog = class Dialog extends HTMLElement {
|
||||||
// 可用属性
|
// 可用属性
|
||||||
static observedAttributes = ['subtitle', 'content', 'hidden']
|
static get observedAttributes() {
|
||||||
|
return ['subtitle', 'content', 'hidden']
|
||||||
|
}
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
this.dialog = null
|
this.dialog = null
|
||||||
@@ -1016,7 +1018,7 @@ class UI {
|
|||||||
--btn-background-color: linear-gradient(to bottom, #7983ff, #3297f3);
|
--btn-background-color: linear-gradient(to bottom, #7983ff, #3297f3);
|
||||||
}
|
}
|
||||||
.dialog-mask {
|
.dialog-mask {
|
||||||
position: absolute;
|
position: fixed;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: var(--mask-color);
|
background-color: var(--mask-color);
|
||||||
@@ -1103,10 +1105,12 @@ class UI {
|
|||||||
Object.assign(this, options)
|
Object.assign(this, options)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO:模态框
|
// 模态框
|
||||||
this.Modal = class Modal extends HTMLElement {
|
this.Modal = class Modal extends HTMLElement {
|
||||||
// 可用属性
|
// 可用属性
|
||||||
static observedAttributes = ['subtitle', 'content', 'hidden']
|
static get observedAttributes() {
|
||||||
|
return ['subtitle', 'content', 'hidden']
|
||||||
|
}
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
// 模态框
|
// 模态框
|
||||||
@@ -1116,7 +1120,7 @@ class UI {
|
|||||||
// 标题
|
// 标题
|
||||||
this.subtitle = '标题'
|
this.subtitle = '标题'
|
||||||
// 内容
|
// 内容
|
||||||
this.content = '第一行<br/><br/>第二行<br/><br/>第三行<br/><br/>第四行'
|
this.content = '内容'
|
||||||
// 动画定时器
|
// 动画定时器
|
||||||
this.timer = null
|
this.timer = null
|
||||||
// 是否隐藏
|
// 是否隐藏
|
||||||
@@ -1251,7 +1255,9 @@ class UI {
|
|||||||
// TODO:选项卡
|
// TODO:选项卡
|
||||||
this.Tab = class Tab extends HTMLElement {
|
this.Tab = class Tab extends HTMLElement {
|
||||||
// 可用属性
|
// 可用属性
|
||||||
static observedAttributes = ['list', 'current']
|
static get observedAttributes() {
|
||||||
|
return ['list', 'current']
|
||||||
|
}
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
// 选项卡
|
// 选项卡
|
||||||
@@ -1296,7 +1302,7 @@ class UI {
|
|||||||
--text-color: black;
|
--text-color: black;
|
||||||
--background-color: transparent;
|
--background-color: transparent;
|
||||||
--description-color: #424242;
|
--description-color: #424242;
|
||||||
--gap: 5em;
|
--gap: 1em;
|
||||||
}
|
}
|
||||||
.tab-list {
|
.tab-list {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
Reference in New Issue
Block a user