1.找到自己想要的组件,点击下载安装
2.选择导入插件(建议使用Hbuilder导入插件)
3.根据浏览器请求打开Hbuilder,选择要导入的项目
4.导入成功后,会出现下面这个文件
5.导入模块;在需要使用的页面的script模块中写入以下代码块
<script>
import unicalendar from '@/uni_modules/uni-calendar/components/uni-calendar/uni-calendar'
export default {
data() {
return {
}
},
components: {
unicalendar: unicalendar
},
methods: {
}
}
</script>
其中import unicalendar... 中的unicalendar是自命名的组件面,后面@/uni_modules/uni-calendar/components/uni-calendar/uni-calendar' 是组件位置;components 一定要写
组件位置快速寻找方法
选中要导入的vue文件,右键属性找到其位置,然后复制位置(D:\yungu\PostRegulation-test\PostRegulation\uni_modules\uni-calendar\components\uni-calendar),截取uni后面的路径,将\改为/即可,注意最后还要多加一个/uni-calendar才行
6.引用模块
复制官网的代码测试;
<view>
<uni-calendar
:insert="true"
:lunar="true"
:start-date="'2019-3-2'"
:end-date="'2019-5-20'"
@change="change"
/>
</view>
测试成功,即完成组件导入与使用