diff --git a/src/skeleton/__test__/index.test.js b/src/skeleton/__test__/index.test.js index add013c0f..066e9d80b 100644 --- a/src/skeleton/__test__/index.test.js +++ b/src/skeleton/__test__/index.test.js @@ -26,7 +26,7 @@ describe('skeleton', () => { describe('Props', () => { it(`: style && customStyle`, async () => { const id = simulate.load({ - template: ``, + template: ``, usingComponents: { 't-skeleton': skeleton, }, diff --git a/src/skeleton/skeleton.ts b/src/skeleton/skeleton.ts index 7e578c0ac..3e43089a2 100644 --- a/src/skeleton/skeleton.ts +++ b/src/skeleton/skeleton.ts @@ -37,6 +37,19 @@ export default class Skeleton extends SuperComponent { rowCol() { this.init(); }, + 'loading,delay'(loading: boolean, delay: number) { + if (!loading || delay === 0) { + this.setData({ + isShow: loading, + }); + return; + } + setTimeout(() => { + this.setData({ + isShow: loading, + }); + }, delay); + }, }; lifetimes = { diff --git a/src/skeleton/skeleton.wxml b/src/skeleton/skeleton.wxml index b5501c128..e6919ad03 100644 --- a/src/skeleton/skeleton.wxml +++ b/src/skeleton/skeleton.wxml @@ -1,6 +1,6 @@ - +