帖子
帖子
用户
博客
课程
显示全部楼层
3
帖子
0
勋章
37
Y币

[插件使用] api.require没有生效

[复制链接]
发表于 2022-8-15 16:58:11
<template>
    <safe-area class="page">
        <view class="header">
            <text class="title">首页</text>
        </view>

    </safe-area>
</template>
<script>
export default {
    name: 'main',
    apiready() {
        var that = this;
        api.toast({
            msg:'11111'
        })
        var demo = api.require('slidingList');
        api.toast({
            msg:demo
        })
        api.toast({
            msg:'2222222'
        })
        demo.showList({
            rightbtn: '确定',
            leftbtn: '取消',
            item_height: '130',
            item_num: '3',
            data: [{
                content: '标题1'
            }, {
                content: '标题2'
            }, {
                content: '标题3'
            }]
        }, function(ret, err) {
            if (ret) {
                alert(JSON.stringify(ret));
            } else {
                alert(JSON.stringify(err));
            }
        });

    },
    data() {
        return {
            msg: "Hello APICloud"
        };
    },
    methods: {

    }
};
</script>
<style>
.page {
    height: 100%;
    background: #fff;
}

.header {
    height: 44px;
    justify-content: center;
    align-items: center;
}

.title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.body {
    background: #f5f6f7;
    flex: 1;
}

.h1 {
    font-size: 22px;
    font-weight: bold;
    color: #333;
    text-align: center;
    margin: 50px;
}

.img {
    max-width: 100%;
}

.p {
    color: #aaa;
    text-align: center;
    font-size: 16px;
    margin: 15px;
}
</style>



重复贴
您需要登录后才可以回帖 登录

本版积分规则