Skip to content

Commit

Permalink
feat: 导出 IReactObject IComputedItem IReactWrap
Browse files Browse the repository at this point in the history
  • Loading branch information
theajack committed Nov 2, 2022
1 parent 89d3753 commit 2c5e942
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ export {
react, computed, watch, createProxy, $,
} from 'alins-reactive';

export {IReactItem} from 'alins-utils/src/types/react.d';
export {IReactItem, IReactObject, IReactWrap, IComputedItem} from 'alins-utils/src/types/react.d';

export {version} from '../package.json';
21 changes: 15 additions & 6 deletions scripts/dev/samples/todo-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,29 @@
* @Date: 2022-10-20 23:54:34
* @Description: Coding something
*/
import {button, div, input, style, click, $} from '../alins';
import {
button, div, input, style, click,
$, value, IReactItem, IReactWrap
} from '../alins';

interface IItem {
content: string,
done: boolean,
}

export function todoList () {
const edit = $('');
const list = $([]);
const list = $<IItem[]>([]);
const addItem = () => {
list.push({content: edit.value, done: false});
edit.value = '';
};
const removeItem = (index) => { list.splice(index.value, 1); };
const finishItem = (item) => { item.done = !item.done.value; };
const removeItem = (index: IReactItem<number>) => { list.splice(index.value, 1); };
const finishItem = (item: IReactWrap<IItem>) => { item.done = !item.done.value; };
const clear = () => { list[value] = []; };

const itemStyle = (item) => {
const itemStyle = (item: IReactWrap<IItem>) => {
return style.textDecoration(() => {
debugger;
return item.done.value ? 'line-through' : 'none';
})
.color(() => item.done.value ? '#888' : '#222');
Expand All @@ -37,6 +45,7 @@ export function todoList () {
),
]),
),
button('clear', click(clear)),
];
}
// // function a (x) {
Expand Down

0 comments on commit 2c5e942

Please sign in to comment.