Skip to content

Commit

Permalink
feat: 0.0.34
Browse files Browse the repository at this point in the history
  • Loading branch information
theajack committed Sep 21, 2023
1 parent 028a001 commit af72aa2
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/client-reactive/src/computed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const age1 = age++;

if (isDepReactive()) {
// todo check return cache
proxy = createProxy(wrapReactive(v, true), { set, get: () => cache, isProp });
proxy = createProxy(wrapReactive(v, true), { set, get, isProp });
return proxy;
}
// ! 此处是为了兼容编译时将未知类型的import常量进行表达式计算时进行的统一computed处理的开销
Expand Down
30 changes: 21 additions & 9 deletions scripts/dev/samples/playground.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
function Main () {
let count = 0;
const add = () => {count++;};
return <div $switch={count}>
<button $case={1} $break={false} onclick={add}>Count is 1</button>
<button $case={2} onclick={add}>Count is 1 or 2:{count}</button>
<button $default onclick={add}>Other Count:{count}</button>
</div>;
let count = 1;
const countAdd2 = count + 2;
const countAdd3 = countAdd2 + 1;
function countMultiply2 () {
return count * 2;
}
<Main $$App/>;
<div $$App>
<button onclick={count++}>
click:{count}
</button>
<div>count + 2 = {countAdd2}</div>
<div>count + 3 = {countAdd3}</div>
<div>count + 4 = {countAdd3 + 1}</div>
<div>count * 2 = {countMultiply2}</div>
<div>count * 2 = {countMultiply2()}</div>
<div>count * 4 = {countMultiply2() * 2}</div>
</div>;


// let age = 0;
// const age1 = age++;
// <button onclick={age++} $$App>Add {age} {age1}</button>;
3 changes: 2 additions & 1 deletion scripts/helper/version.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
- [ ] Async Data 类型标注
- [ ] computed 重构;dirty 标记。优化 const b = a++; 逻辑

## 0.0.33
## 0.0.33 - 0.0.34

- [x] fix nodejs 环境下使用
- [x] fix computed

## 0.0.32

Expand Down
23 changes: 23 additions & 0 deletions scripts/test/demos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -482,4 +482,27 @@ a++;
<ElseIf data={a === 2}>2</ElseIf>
<div $elseif={a === 3}>3</div>
<Else>4</Else>
</div>;

function mockFetch () {
return new Promise(resolve => {
setTimeout(() => {
resolve({ name: 'Bob', age: 10 });
}, 2000);
});
}

function Component () {
// You can specify the name of the $data through the name attribute: name='persion'
return <Async data={mockFetch()}>
<div>name={$data.name}; age={$data.age}</div>
</Async>;
}
function Attribute () {
// You can specify the name of the $data through the name attribute: $name='persion'
return <div $async={mockFetch()}>name={$data.name}; age={$data.age}</div>;
}
<div $$App>
<Component/>
<Attribute/>
</div>;

0 comments on commit af72aa2

Please sign in to comment.