uniapp使用uview报错Cannot find module ‘@/uni_modules/uview-ui/components

参考:https://github.com/umicro/uView

记录使用uniapp报的错

注意uview目前只支持vue2

按照教程引入uview,然后执行的时候还是会报Cannot find module '@/uni_modules/uview-ui/components意思是找不到uview的组件,然后我反复对比官网配置的东西都对的呀,最后到index.vue发现不能在原来的基础上插入我的新的组件,需要把原来<script><style>标签的都删了,然后重新写如下内容
var code = “bd89a287-e83e-406f-ac61-710f083b6be9”

<template>
	
	<view class="content">
				<h1>uView</h1>
				<view class="text-area">
					<u-icon name="home"></u-icon>
					<text>Home图标</text>
				</view>
				<view style="text-align: center;color: #366092;">
					<u-button type="primary" icon="home">HomeButton</u-button>
				</view>
				<view>
					<u-loading-icon text="加载" textSize="15"></u-loading-icon>
				</view>
	</view>
</template>

直接运行就OK了

posted @ 2023-12-13 10:53  蜗牛使劲冲  阅读(425)  评论(0编辑  收藏  举报  来源