Skip to content

Commit

Permalink
fix: bug
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver3109 committed Sep 7, 2020
1 parent 7173c23 commit fa0040c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dragon-totem",
"version": "0.0.13",
"version": "0.0.19",
"description": "H5图形编排工具",
"main": "dist/node/index.js",
"types": "dist/node/index.d.ts",
Expand Down
21 changes: 8 additions & 13 deletions src/core/component/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import Event from '../utils/event'
import { uuid } from '../utils/util'

export default class Component {

export default abstract class Component {
// TODO: 1. Component properties 组件的属性
// 1) 唯一标识别(内部使用)
// 2) 位置信息(相对于父容器)
Expand All @@ -26,7 +27,7 @@ export default class Component {
/**
* 初始化
*/
init() {
private init() {
let s = setTimeout(() => {
this.hookEvent('created')
clearTimeout(s)
Expand Down Expand Up @@ -58,7 +59,7 @@ export default class Component {
* @param {*} eventName
* @param {*} fn
*/
on(eventName: string, fn: Function) {
protected on(eventName: string, fn: Function) {
this.event.on(eventName, fn)
}

Expand All @@ -67,10 +68,10 @@ export default class Component {
// 2) 更新位置
// 3) 渲染
// 4) 更新状态
setStyle() { }
updateLocation() { }
render() { }
updateStatus() { }
protected setStyle() { }
protected updateLocation() { }
protected render() { }
protected updateStatus() { }
// TODO: 2. Component life cycle 组件的声明周期
// 1) 创建
// 2) 渲染
Expand All @@ -94,9 +95,3 @@ export default class Component {
onFocus() { }
onBlur() { }
}

class Test extends Component {
constructor() {
super()
}
}
5 changes: 4 additions & 1 deletion src/core/component/text-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function key2unit(key: string) {
if (NeedAddPx.includes(key)) {
return 'px'
}
return '';
}

export default class TextField {
Expand Down Expand Up @@ -348,9 +349,11 @@ export default class TextField {
*/
public setStyle(style: Style) {
for (const key in style) {
if (this.config.style) {
this.config.style[key] = style[key]
}
this.document.style.setProperty(hump2Underline(key), `${style[key]}${key2unit(key)}`)
}
this.config.style = style
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/core/dragon-totem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export class DragonTotem {
x, // 坐标x
y, // 坐标y
style: {
color = '#676767', // 文本颜色
width = 94, // 文本输入框宽度(px)
lineHeight = 20, // 字体行高
fontSize = 14, // 字体大小(px)
Expand All @@ -100,6 +101,7 @@ export class DragonTotem {
y,
classList: ['item item-comp item-comp-hover'],
style: {
color,
width,
lineHeight,
fontSize,
Expand Down
9 changes: 3 additions & 6 deletions src/dragon-totem.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ body * {
&:hover,
&:active {
background: #eee;
color: #0aaf88;
color: #38d4b0;
}
}
&:first-of-type {
Expand All @@ -48,7 +48,6 @@ body * {
// 每个自定义元素
& > .item {
z-index: 99;
color: #676767;
line-height: 1;
background: none;
position: absolute;
Expand All @@ -73,17 +72,15 @@ body * {
writing-mode: horizontal-tb;
text-align: left;
background-color: rgba(255, 255, 255, 0);
font-weight: bold;
z-index: 8;
color: rgb(103, 103, 103);
transform: none;
border-width: 0px;
border-style: solid;
border-color: rgb(0, 0, 0);
border-color: #000000;
border-radius: 0px;
padding-bottom: 0px;
padding-top: 0px;
box-shadow: rgba(0, 0, 0, 0.5) 0px 0px 0px;
box-shadow: #00000080 0px 0px 0px;
text-decoration: none;
letter-spacing: 0px;
margin-top: 0px;
Expand Down

0 comments on commit fa0040c

Please sign in to comment.