Skip to content

Commit

Permalink
remove code
Browse files Browse the repository at this point in the history
  • Loading branch information
cuixiaorui committed Oct 13, 2021
1 parent e82526e commit be129e2
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 62 deletions.
17 changes: 0 additions & 17 deletions lib/mini-vue.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/mini-vue.cjs.js.map

Large diffs are not rendered by default.

17 changes: 0 additions & 17 deletions lib/mini-vue.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/mini-vue.esm.js.map

Large diffs are not rendered by default.

26 changes: 0 additions & 26 deletions src/runtime-dom/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,32 +59,6 @@ export function hostPatchProp(el, key, preValue, nextValue) {
el.setAttribute(key, nextValue);
}
}

switch (key) {
case "id":
case "tId":
if (nextValue === null || nextValue === undefined) {
el.removeAttribute(key);
} else {
el.setAttribute(key, nextValue);
}
break;
case "onClick":
// todo
// 先临时实现 click 事件
// 后面应该用 directive 来处理
// todo
// 需要参考 runtime-dom 的做法
// 这里需要额外的处理 nextValue 的值
// 因为 nextValue 是一个匿名函数的话,那么对比的时候,肯定2个匿名函数就不一样了
// 然后就会注册了2遍事件监听
if (preValue) {
// 先临时 reset
el.removeEventListener("click", preValue);
}
el.addEventListener("click", nextValue);
break;
}
}

export function hostInsert(child, parent, anchor = null) {
Expand Down

0 comments on commit be129e2

Please sign in to comment.