This repository has been archived on 2023-08-29. You can view files and clone it, but cannot push or open issues/pull-requests.
yutent
/
anot.js
Archived
1
0
Fork 0
master
宇天 2021-07-30 11:52:50 +08:00
parent 33429266f3
commit 328a7ca6d5
1 changed files with 4 additions and 11 deletions

View File

@ -85,10 +85,7 @@ Anot.PropsTypes.isBoolean = function() {
/*判定是否是一个朴素的javascript对象Object不是DOM对象不是BOM对象不是自定义类的实例*/ /*判定是否是一个朴素的javascript对象Object不是DOM对象不是BOM对象不是自定义类的实例*/
Anot.isPlainObject = function(obj) { Anot.isPlainObject = function(obj) {
// 简单的 typeof obj === "object"检测会致使用isPlainObject(window)在opera下通不过 // 简单的 typeof obj === "object"检测会致使用isPlainObject(window)在opera下通不过
return ( return serialize.call(obj) === '[object Object]' && Object.getPrototypeOf(obj) === oproto
serialize.call(obj) === '[object Object]' &&
Object.getPrototypeOf(obj) === oproto
)
} }
let VMODELS = (Anot.vmodels = {}) //所有vmodel都储存在这里 let VMODELS = (Anot.vmodels = {}) //所有vmodel都储存在这里
@ -168,11 +165,7 @@ Anot.mix = Anot.fn.mix = function() {
if (target === copy) { if (target === copy) {
continue continue
} }
if ( if (deep && copy && (Anot.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
deep &&
copy &&
(Anot.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))
) {
if (copyIsArray) { if (copyIsArray) {
copyIsArray = false copyIsArray = false
clone = src && Array.isArray(src) ? src : [] clone = src && Array.isArray(src) ? src : []
@ -278,7 +271,7 @@ Anot.mix({
t = t.trim() t = t.trim()
let hook = hooks[t] let hook = hooks[t]
if (typeof hook === 'object') { if (typeof hook === 'object') {
t = hook.type || type t = hook.type || t
phase = hook.phase || !!phase phase = hook.phase || !!phase
fn = hook.fix ? hook.fix(el, fn) : fn fn = hook.fix ? hook.fix(el, fn) : fn
} }
@ -295,7 +288,7 @@ Anot.mix({
t = t.trim() t = t.trim()
let hook = hooks[t] let hook = hooks[t]
if (typeof hook === 'object') { if (typeof hook === 'object') {
t = hook.type || type t = hook.type || t
phase = hook.phase || !!phase phase = hook.phase || !!phase
} }
el.removeEventListener(t, fn, phase) el.removeEventListener(t, fn, phase)