uniapp中扩展组件uni ui的使用

1、例如--日历

<template>
    <view>
        <!-- template中的内容正常在官网复制 -->
        <uni-calendar 
        :insert="true"
        :lunar="true" 
        :start-date="'2019-3-2'"
        :end-date="'2019-5-20'"
        @change="change"
         ></uni-calendar>
    </view>
</template>

<script>
    // 引入方式统一以下面这种,只更换解构部分
    import {uniCalendar} from '@dcloudio/uni-ui'
    export default {
        // 引入后进行组件注册,即可使用
        components: {
            uniCalendar 
        },
        data() {
            return {};
        },
        methods: {
            change(e) {
                console.log(e);
            }
        }
    };
</script>

<style lang="scss">

</style>

2、例如--滚动通知栏

<template>
    <view>
        <h2>index页面</h2>
        <!-- 写入标签模板 -->
        <uni-notice-bar scrollable="true" single="true" text="[单行] 这是 NoticeBar 通告栏,这是 NoticeBar 通告栏,这是 NoticeBar 通告栏"></uni-notice-bar>
    </view>
</template>

<script>
    // 引入对应扩展插件
    import {uniNoticeBar} from '@dcloudio/uni-ui'
    export default {
        data() {
            return {

            }
        },
        onLoad() {

        },
        methods: {
            
        },
        // 注册插件
        components: {
            uniNoticeBar
        }
    }
</script>

<style>

</style>

猜你喜欢

转载自www.cnblogs.com/Alex-Song/p/12160125.html