MCPcopy
hub / github.com/youzan/vant-weapp / detached

Function detached

packages/mixins/page-scroll.ts:48–64  ·  view source on GitHub ↗
(this: WechatMiniprogram.Component.TrivialInstance)

Source from the content-addressed store, hash-verified

46 },
47
48 detached(this: WechatMiniprogram.Component.TrivialInstance) {
49 const page = getCurrentPage<{ vanPageScroller: Scroller[] }>();
50
51 if (!isDef(page) || !isDef(page.vanPageScroller)) {
52 return;
53 }
54
55 const { vanPageScroller } = page;
56
57 const index = vanPageScroller.findIndex((v) => v === this._scroller);
58
59 if (index > -1) {
60 page.vanPageScroller.splice(index, 1);
61 }
62
63 this._scroller = undefined;
64 },
65 });
66}

Callers

nothing calls this directly

Calls 2

getCurrentPageFunction · 0.90
isDefFunction · 0.50

Tested by

no test coverage detected