技术学习

我所喜欢的

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

1、page.json 中easycom设置

"easycom": {
		"autoscan": true,
		"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue",
		"^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue",
		"^das-(.*)": "@/components/das-ui/das-$1/das-$1.vue"
		// "^das-(.*)": "das-ui/das-$1/das-$1.vue"
		// "custom": {
		// 	"^das-(.*)": "@/components/das-ui/das-$1/das-$1.vue"
		// }
		// "autoscan": true,
		// "custom": {
		// 	// uni-ui 规则如下配置
		// 	"^das-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue"
			
		// }
	},

  注意上述uview-ui目录和@dcloudio目录都是针对的node_modules

官方指定的easycom目录是src目录下的components目录,另外上述配置要生效需要配置vue.config.js

// vue.config.js
module.exports = {
		transpileDependencies:['@dcloudio/uni-ui','uview-ui','das-ui'],
} 

加入自定义组件das-ui,全部放入src/components/das-ui目录下,组件目录结构如下:

src/components/das-ui/das-input/das-input.vue

 Easycom导入:@代表src根目录

"^das-(.*)": "@/components/das-ui/das-$1/das-$1.vue"
posted on 2025-04-28 15:57  飘扬De黑夜  阅读(186)  评论(0)    收藏  举报