uniapp-x之uts插件运行hutool
若要为自己而活,首先必须为别人而活。——色内卡 注意这里是安卓真机设备 注意配置好HBuilderX的gradle配置、JDK配置、安卓SDK配置等,在HBuilderX的运行配置中能找到 首先HBuilderX新建一个uniapp-x工程 就是在uni-app项目默认模板下面勾选uni-app x 然后先运行到安卓手机上,我们自定义一个基座 HBuilderX选择运行——运行到手机或模拟器——制作自定义调试基座 我这里输入包名,等待云打包完成后即可在运行到Android真机设备时选择自定义基座运行 然后我们右键新建一个目录叫uni_modules,右键uni_modules新建uni_modules插件 选择UTS插件-API插件新建,我这里输入的名字叫dromara-hutool 新建以后我们在uni_modules/dromara-hutool/utssdk/app-android/config.json中引入hutool的依赖 123456{ "minSdkVersion": "21", "dependenc...
uniapp自动化测试
日常生活的摩擦龃龉,十之其九起于口舌。——贝涅特 推荐使用HBuilderX uni-app自动化测试插件 https://ext.dcloud.net.cn/plugin?id=5708 安装完毕,右键项目选择uni-app运行自动化测试即可 这里可以在HBuilderX设置的插件设置里取消勾选“自动修改jest.config.js文件中的testMatch”选项才能自定义测试目录 这是我的jest.config.js: 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455module.exports = { globalTeardown: '@dcloudio/uni-automator/dist/teardown.js', testEnvironment: '@dcloudio/uni-automator/dist/environment.js', testEnvironm...
uniapp-cli工程
人生苦短,虽说如此,还会感到无聊。——佚名 除了HBuilderX可视化界面,也可以使用 cli 脚手架,可以通过 vue-cli 创建 uni-app 项目。 #环境安装全局安装 vue-cli 1npm install -g @vue/cli 复制代码 #创建uni-app 使用正式版(对应HBuilderX最新正式版) 1vue create -p dcloudio/uni-preset-vue my-project 复制代码 使用alpha版(对应HBuilderX最新alpha版) 1vue create -p dcloudio/uni-preset-vue#alpha my-alpha-project 复制代码 使用Vue3/Vite版 创建以 javascript 开发的工程(如命令行创建失败,请直接访问 gitee 下载模板) 1npx degit dcloudio/uni-preset-vue#vite my-vue3-project 复制代码 1npx degit dcloudio/uni-preset-vue#vite-alpha...
uView升级http配置兼容变更
人生须知负责任的苦处,才能知道尽责任的乐趣。——梁启超 今天把老项目uniapp的http封装代码cv过来,发现用不了了,原因是uView版本升级了没适配 原先uView 1.x的方式: 123456789101112131415161718192021222324Vue.prototype.$u.http.setConfig({ baseUrl: 'http://localhost:8080/ruben', loadingText: '加载中...', loadingTime: 100,});Vue.prototype.$u.http.interceptor.request = (config) => { const token = uni.getStorageSync('token'); config.header.token = token; return config;}Vue.prototype.$u.http.interce...
HBuilderX运行到iOS真机
人生的光荣,不在永不失败,而在于能够屡扑屡起。——拿破仑 直接选择运行——运行到手机或模拟器——运行到iOS APP基座 这里使用标准基座运行需要使用Apple证书签名 点开有四个配置项 Bundle ID(AppID)——是自己设置的 这个可以是包名,我们到Identifiers里新建一个,Bundle ID(AppID)填写我们的包名即可 https://developer.apple.com/account/resources/identifiers/list 证书私钥密码——是自己设置的 我们在mac上打开钥匙串访问,左上角菜单栏点击钥匙串访问 选择证书助理——使用"chao a"从证书颁发机构请求证书 然后填写自己设置的密码 此处还生成一个文件CertificateSigningRequest.certSigningRequest 证书profile文件: 在Profiles新建后下载得到robotrobot.mobileprovision,我们在HBuilderX选这个文件即可 https://developer.apple.com/accou...
typescript-exercises(十五)
人的一辈子都在高潮—低潮中浮沉,唯有庸碌的人,生活才如死水一般。——傅雷 问题: 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051/*Intro: Our attempt to Open Source didn't work quite as expected. It turned out there were already many existing functional JS libraries. All the remaining developers left the company as well. It seems that they are joining a very ambitious startup which re-invented a juicer and raised millions of dollars. Too bad we cannot compe...
typescript-exercises(十四)
人心就是立国的大根本。——孙中山 问题: 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194...
typescript-exercises(十三)
人不仅为自己而生,而且也为祖国活着。——柏拉图 题目: 123456// This enables module augmentation mode.import 'date-wizard';declare module 'date-wizard' { // Add your module extensions here.} 报错: 12345index.ts(79,30): error TS2339: Property 'pad' does not exist on type 'typeof import("/node_modules/date-wizard/index.d.ts")'.index.ts(101,67): error TS2339: Property 'hours' does not exist on type 'DateDetails'.test.ts(5,5): error TS2344:...
typescript-exercises(十二)
人民是土壤,它含有要切事物发展所必需的生命汁液;而个人则是这土壤上的花朵与果实。——别林斯基 题目: 123declare module 'stats' { export function getMaxIndex(input: unknown, comparator: unknown): unknown;} 报错: 123456789101112131415index.ts(3,5): error TS2305: Module '"stats"' has no exported member 'getMaxElement'.index.ts(4,5): error TS2724: Module '"stats"' has no exported member 'getMinIndex'. Did you mean 'getMaxIndex'?index.ts(5,5): error TS23...
typescript-exercises(十一)
人只有在人们中间才能认识自己。——歌德 题目: 1234declare module 'str-utils' { // export const ... // export function ...} 报错: 123456index.ts(2,5): error TS2305: Module '"str-utils"' has no exported member 'strReverse'.index.ts(3,5): error TS2305: Module '"str-utils"' has no exported member 'strToLower'.index.ts(4,5): error TS2305: Module '"str-utils"' has no exported member 'strToUpper'.index.ts(...
