Skip to content

Commit

Permalink
audio/video的一些特殊属性渲染设置
Browse files Browse the repository at this point in the history
  • Loading branch information
army8735 committed Jul 13, 2018
1 parent c1d08d5 commit 8df6859
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 25 deletions.
28 changes: 26 additions & 2 deletions build/attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ var NUM = 0;
var STR = 1;
var BOOL = 2;

var RENDER_EXIST = 1;
var RENDER_DOM = 2;
var RENDER_EXIST = 1; // 只有存在时才渲染输出
var RENDER_DOM = 2; // 需要在domready后设置

var SPECIALS = {
button: {
Expand Down Expand Up @@ -58,6 +58,18 @@ var SPECIALS = {
disabled: RENDER_EXIST,
readOnly: RENDER_EXIST,
readonly: RENDER_EXIST
},
audio: {
autoplay: RENDER_EXIST,
controls: RENDER_EXIST,
loop: RENDER_EXIST,
muted: RENDER_EXIST
},
video: {
autoplay: RENDER_EXIST,
controls: RENDER_EXIST,
loop: RENDER_EXIST,
muted: RENDER_EXIST
}
};

Expand Down Expand Up @@ -105,6 +117,18 @@ var SETS = {
readonly: BOOL,
required: BOOL,
value: STR
},
audio: {
autoplay: BOOL,
controls: BOOL,
loop: BOOL,
muted: BOOL
},
video: {
autoplay: BOOL,
controls: BOOL,
loop: BOOL,
muted: BOOL
}
};

Expand Down
6 changes: 3 additions & 3 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "migi",
"version": "5.0.0",
"version": "5.0.1",
"description": "A JavaScript MVVM on JSX",
"maintainers": [
{
Expand Down
58 changes: 41 additions & 17 deletions src/attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ const NUM = 0;
const STR = 1;
const BOOL = 2;

const RENDER_EXIST = 1;
const RENDER_DOM = 2;
const RENDER_EXIST = 1; // 只有存在时才渲染输出
const RENDER_DOM = 2; // 需要在domready后设置

const SPECIALS = {
button: {
disabled: RENDER_EXIST
disabled: RENDER_EXIST,
},
input: {
autofocus: RENDER_EXIST,
Expand All @@ -22,38 +22,50 @@ const SPECIALS = {
multiple: RENDER_EXIST,
readOnly: RENDER_EXIST,
readonly: RENDER_EXIST,
required: RENDER_EXIST
required: RENDER_EXIST,
},
link: {
disabled: RENDER_EXIST
disabled: RENDER_EXIST,
},
option: {
defaultSelected: RENDER_DOM,
defaultselected: RENDER_DOM,
disabled: RENDER_EXIST,
selected: RENDER_EXIST,
text: RENDER_DOM
text: RENDER_DOM,
},
select: {
autofocus: RENDER_EXIST,
disabled: RENDER_EXIST,
multiple: RENDER_EXIST,
selectedIndex: RENDER_DOM,
selectedindex: RENDER_DOM
selectedindex: RENDER_DOM,
},
textarea: {
autofocus: RENDER_EXIST,
defaultValue: RENDER_DOM,
defaultvalue: RENDER_DOM,
disabled: RENDER_EXIST,
readOnly: RENDER_EXIST,
readonly: RENDER_EXIST
}
readonly: RENDER_EXIST,
},
audio: {
autoplay: RENDER_EXIST,
controls: RENDER_EXIST,
loop: RENDER_EXIST,
muted: RENDER_EXIST,
},
video: {
autoplay: RENDER_EXIST,
controls: RENDER_EXIST,
loop: RENDER_EXIST,
muted: RENDER_EXIST,
},
};

const SETS = {
button: {
disabled: BOOL
disabled: BOOL,
},
input: {
autofocus: BOOL,
Expand All @@ -66,25 +78,25 @@ const SETS = {
readOnly: BOOL,
readonly: BOOL,
required: BOOL,
value: STR
value: STR,
},
link: {
checked: BOOL
checked: BOOL,
},
option: {
defaultSelected: BOOL,
defaultselected: BOOL,
disabled: BOOL,
selected: BOOL,
text: STR
text: STR,
},
select: {
autofocus: BOOL,
disabled: BOOL,
required: BOOL,
selectedIndex: NUM,
selectedindex: NUM,
value: STR
value: STR,
},
textarea: {
autofocus: BOOL,
Expand All @@ -94,16 +106,28 @@ const SETS = {
readOnly: BOOL,
readonly: BOOL,
required: BOOL,
value: STR
}
value: STR,
},
audio: {
autoplay: BOOL,
controls: BOOL,
loop: BOOL,
muted: BOOL,
},
video: {
autoplay: BOOL,
controls: BOOL,
loop: BOOL,
muted: BOOL,
},
};

const lowerCase = {
defaultchecked: 'defaultChecked',
defaultselected: 'defaultSelected',
defaultvalue: 'defautlValue',
readonly: 'readOnly',
selectindex: 'selectIndex'
selectindex: 'selectIndex',
};

export default {
Expand Down
28 changes: 26 additions & 2 deletions web/attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ var NUM = 0;
var STR = 1;
var BOOL = 2;

var RENDER_EXIST = 1;
var RENDER_DOM = 2;
var RENDER_EXIST = 1; // 只有存在时才渲染输出
var RENDER_DOM = 2; // 需要在domready后设置

var SPECIALS = {
button: {
Expand Down Expand Up @@ -58,6 +58,18 @@ var SPECIALS = {
disabled: RENDER_EXIST,
readOnly: RENDER_EXIST,
readonly: RENDER_EXIST
},
audio: {
autoplay: RENDER_EXIST,
controls: RENDER_EXIST,
loop: RENDER_EXIST,
muted: RENDER_EXIST
},
video: {
autoplay: RENDER_EXIST,
controls: RENDER_EXIST,
loop: RENDER_EXIST,
muted: RENDER_EXIST
}
};

Expand Down Expand Up @@ -105,6 +117,18 @@ var SETS = {
readonly: BOOL,
required: BOOL,
value: STR
},
audio: {
autoplay: BOOL,
controls: BOOL,
loop: BOOL,
muted: BOOL
},
video: {
autoplay: BOOL,
controls: BOOL,
loop: BOOL,
muted: BOOL
}
};

Expand Down

0 comments on commit 8df6859

Please sign in to comment.