一:直接找官方文档中:组件——宽展组件——选择需要的进入点击(导入插件)——直接复制到自己组件使用即可!
例如日历使用:
<template>
<view class="content">
<view>
<uni-calendar
:insert="true"
:lunar="true"
:start-date="'2019-3-2'"
:end-date="'2019-5-20'"
@change="change"
/>
</view>
<view>
<uni-calendar
ref="calendar"
:insert="false"
@confirm="confirm"
/>
<button @click="open">打开日历</button>
</view>
</view>
</template>
<script>
export default {
methods:{
open(){
this.$refs.calendar.open();
},
confirm(e) {
console.log(e);
},
change(){
console.log("触发了本次页面")
}
}
</script>
<style>
</style>