在uniapp中调用了自己编写的js文件时,发现在app端引入文件可以声明在components中,但是如果是小程序端执行时就会报错,提示Component is not found in path “common/time” (using by “pages/…******”);onAppRoute.
这是后需要调整一下声明的写法,把js的声明放到common中即可,如下:
import detailInfo from '../../components/detail/detail-info.vue';
import timeUtil from '../../common/time.js';
import commentList from '../../components/detail/comment-list.vue';
import userChatBottom from '../../components/user-chat/user-chat-bottom.vue';
import moreShare from '../../components/common/more-share.vue';
export default {
components:{
detailInfo,
commentList,
userChatBottom,
moreShare
},
common:{
timeUtil
},