docs(Lazyload): use composition api

This commit is contained in:
chenjiahan 2020-12-13 14:04:56 +08:00
parent 7537370343
commit af49575484
3 changed files with 20 additions and 15 deletions

View File

@ -25,7 +25,7 @@ app.use(Lazyload, {
```js ```js
export default { export default {
data() { setup() {
return { return {
imageList: [ imageList: [
'https://img.yzcdn.cn/vant/apple-1.jpg', 'https://img.yzcdn.cn/vant/apple-1.jpg',

View File

@ -29,7 +29,7 @@ app.use(Lazyload, {
```js ```js
export default { export default {
data() { setup() {
return { return {
imageList: [ imageList: [
'https://img.yzcdn.cn/vant/apple-1.jpg', 'https://img.yzcdn.cn/vant/apple-1.jpg',

View File

@ -18,21 +18,26 @@
</demo-block> </demo-block>
</template> </template>
<script> <script lang="ts">
export default { import { useTranslate } from '@demo/use-translate';
i18n: {
'zh-CN': { const i18n = {
title2: '背景图懒加载', 'zh-CN': {
title3: '懒加载模块', title2: '背景图懒加载',
}, title3: '懒加载模块',
'en-US': { },
title2: 'Lazyload Background Image', 'en-US': {
title3: 'Lazyload Component', title2: 'Lazyload Background Image',
}, title3: 'Lazyload Component',
}, },
};
export default {
setup() {
const t = useTranslate(i18n);
data() {
return { return {
t,
imageList: [ imageList: [
'https://img.yzcdn.cn/vant/apple-1.jpg', 'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg', 'https://img.yzcdn.cn/vant/apple-2.jpg',