feat(types): feat(types): add ComponentCustomProperties interface (#982)

This commit is contained in:
Evan You
2020-04-17 09:12:50 -04:00
parent 4cf5e07608
commit be21cfb1db
5 changed files with 59 additions and 7 deletions

View File

@@ -20,7 +20,6 @@ import {
import {
currentInstance,
ComponentInternalInstance,
Data,
isInSSRComponentSetup,
recordInstanceBoundEffect
} from './component'
@@ -276,9 +275,11 @@ export function instanceWatch(
cb: Function,
options?: WatchOptions
): StopHandle {
const ctx = this.proxy as Data
const getter = isString(source) ? () => ctx[source] : source.bind(ctx)
const stop = watch(getter, cb.bind(ctx), options)
const publicThis = this.proxy as any
const getter = isString(source)
? () => publicThis[source]
: source.bind(publicThis)
const stop = watch(getter, cb.bind(publicThis), options)
onBeforeUnmount(stop, this)
return stop
}