# basic-frame **Repository Path**: welives/basic-frame ## Basic Information - **Project Name**: basic-frame - **Description**: uni-app的cli工程基础框架 - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 1 - **Created**: 2021-03-14 - **Last Updated**: 2023-03-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # **前端工程搭建说明** > ## 1.项目说明 ``` 本项目不是通过 HBuilderX 可视化界面创建的标准项目,而是使用了uniapp官方提供的vue-cli脚手架进行创建的,具体请参考官方文档 [通过vue-cli命令行](https://uniapp.dcloud.net.cn/quickstart-cli) ``` > ## 2.安装相关依赖 ``` npm install 依赖安装完之后,请到 node_modules 文件夹中找到 uview-ui 文件夹,然后进行第3步的源码修改。请一定要操作第3步!请一定要操作第3步!请一定要操作第3步!否则会出现bug ``` > ## 3.本项目使用了[uViewUI](https://v1.uviewui.com/components/intro.html) 作为基础UI框架,并对框架源码做了一些修改,以下是一些改动记录,主要是修复使用中发现的bug和增加功能 ``` ``` `uview-ui/libs/function/toast.js` ``` 第2行附近 增加 if(!title) return ``` `uview-ui/components/u-image/u-image.vue` ``` 第108行 default: true 修改为 default: false ``` `uview-ui/components/u-number-box/u-number-box.vue` ``` 第9行附近 修改为 =================== 第26行附近 修改为 =================== 第141行附近 增加 // 左侧图标 leftIcon: { type: String, default: 'minus' }, // 右侧图标 rightIcon: { type: String, default: 'plus' } ``` `uview-ui/components/u-navbar/u-navbar.vue` ``` 第232行附近 this.customBack.bind(this.$u.$parent.call(this))(); 修改为 // #ifndef MP this.customBack.bind(this.$u.$parent.call(this))(); // #endif // #ifdef MP this.customBack.call(this.$parent) // #endif ``` `uview-ui/components/u-upload/u-upload.vue` ``` 第26行附近 height="16" 修改为 height="6" =================== 第394行附近 let beforeResponse = this.beforeUpload.bind(this.$u.$parent.call(this))(index, this.lists); 修改为 let beforeResponse = undefined // #ifndef MP beforeResponse = this.beforeUpload.bind(this.$u.$parent.call(this))(index, this.lists); // #endif // #ifdef MP beforeResponse = this.beforeUpload.call(this.$parent, index, this.lists); // #endif =================== 第411行附近 if (!this.action) { this.showToast('请配置上传地址', true); return; } 修改为 this.$nextTick(()=>{ if (!this.action) { this.showToast('请配置上传地址', true); return; } }) =================== 第420行附近 const task = uni.uploadFile({ url: this.action, filePath: this.lists[index].url, name: this.name, formData: this.formData, header: this.header, success: res => { // 判断是否json字符串,将其转为json格式 let data = this.toJson && this.$u.test.jsonString(res.data) ? JSON.parse(res.data) : res.data; if (![200, 201, 204].includes(res.statusCode)) { this.uploadError(index, data); } else { // 上传成功 this.lists[index].response = data; this.lists[index].progress = 100; this.lists[index].error = false; this.$emit('on-success', data, index, this.lists, this.index); } }, fail: e => { this.uploadError(index, e); }, complete: res => { uni.hideLoading(); this.uploading = false; this.uploadFile(index + 1); this.$emit('on-change', res, index, this.lists, this.index); } }); task.onProgressUpdate(res => { if (res.progress > 0) { this.lists[index].progress = res.progress; this.$emit('on-progress', res, index, this.lists, this.index); } }); 修改为 this.$nextTick(()=>{ const task = uni.uploadFile({ url: this.action, filePath: this.lists[index].url, name: this.name, formData: this.formData, header: this.header, success: res => { // 判断是否json字符串,将其转为json格式 let data = this.toJson && this.$u.test.jsonString(res.data) ? JSON.parse(res.data) : res.data; if (![200, 201, 204].includes(res.statusCode)) { this.uploadError(index, data); } else { // 上传成功 this.lists[index].response = data || this.formData.key; this.lists[index].progress = 100; this.lists[index].error = false; this.$emit('on-success', data || this.formData.key, index, this.lists, this.index); } }, fail: e => { this.uploadError(index, e); }, complete: res => { uni.hideLoading(); this.uploading = false; this.uploadFile(index + 1); this.$emit('on-change', res, index, this.lists, this.index); } }); task.onProgressUpdate(res => { if (res.progress > 0) { this.lists[index].progress = res.progress; this.$emit('on-progress', res, index, this.lists, this.index); } }); }) =================== 第634行附近 bottom: 10rpx; 修改为 bottom: 0; ```