[mpvue-loader] need "fileExt" option in file "build/vue-loader.conf.js",init a new project and copy

在这里插入图片描述
需要
webpack.base.conf.js -> module->rules 添加
{
test: /.tsx?$/,
// include: [resolve(‘src’), resolve(‘test’)],
exclude: /node_modules/,
use: [
{
loader: ‘babel-loader’,
},
{
loader: ‘mpvue-loader’,
options: Object.assign({ checkMPEntry: true }, vueLoaderConfig)
},
{
// loader: ‘ts-loader’,
loader: ‘awesome-typescript-loader’,
options: {
// errorsAsWarnings: true,
useCache: true,
}
}
]
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
uni.request({ url: config.baseUrl + '/API/Task/getToken', method: 'GET', success(res) { that.baseUrl = res.data.domain that.token = res.data.token; // 获取到 token 后再进行上传 that.imgList.push(e.tempFilePaths[0]); const fileName = e.tempFilePaths[0].substr(e.tempFilePaths[0] .lastIndexOf('/') + 1); // 获取文件名 const fileExt = fileName.substr(fileName.lastIndexOf('.') + 1) .toLowerCase(); // 获取文件拓展名,并转换为小写 const today = new Date().toISOString().slice(0, 10); // 获取当天日期,格式为 yyyy-mm-dd const now = new Date(); const year = now.getFullYear(); const month = now.getMonth() + 1; const day = now.getDate(); const hour = now.getHours(); const minute = now.getMinutes(); const currentDateTime = ${year}-${month}-${day}-${hour}:${minute}:00; var nums = []; that.uploadCount++; // 上传次数加一 const newFileName = currentDateTime + '' + that.uploadCount + '.' + fileExt; // 生成新的文件名,以上传次数为前缀 const path = that.fromData.c_name + '/' + that.fromData.a_name + '/' + that.fromData.m_name + '/' + that.fromData.mold + '/' + that.fromData.m_title + '/' + that.fromData.r_name + '-' + that.uploadCount + '/' + that.fromData.o_name + '/' + today; const key = path + '/' + newFileName that.imgData.push(key) uni.uploadFile({ url: 'https://upload-z1.qiniup.com', filePath: e.tempFilePaths[0], name: 'file', formData: { token: res.data.token, key: path + '/' + newFileName // 将路径和文件名拼接起来 }, success(res) { const data = JSON.parse(res.data); const key = data.key const parts = key.split("."); const KeynewName = parts.slice(0, -1).join(".") + ".jpg"; that.baseList.push(that.baseUrl + KeynewName) that.Keyname.push(KeynewName) for (var i = 0; i < that.Keyname.length; i++) { var num = that.Keyname[i].split('/').slice(-1)[0].split('.')[0].split('')[1]; nums.push(num); } console.log('存在的文件名:'+nums) }, fail(erro) { console.log(erro); } }); }, fail(err) { console.log("获取 Token 失败:", err); } });我想让这里的uploadCount先判断nums中存在哪些,uploadCount只能为1,2,3 如果nums存在1,2那么uploadCount只能为3
最新发布
06-10

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值