命令行难用的一批,我都被折磨死了。
小程序持续发布jenkins+ /Applications/wechatwebdevtools.app/Contents/Resources/app.nw/bin/cli -p fe-toutiao-wp Initializing... idePortFile: /Users/ptqa/Library/Application Support/微信web开发者工具/Default/.ide IDE server has started, listening on *********initialization finished preparing preview... StatusCodeError: 400 - "{\"code\":400002,\"error\":\"请检查是否 project.config.json 是否存在及是否有效\"}" 这个项目在本地可以正常打开,用命令行打开如上报错,什么原因?project.config.json确实存在,有效不有效怎么判断?
2018-11-08同样遇到了如此bug。win系统下,project.config.json明明存在,路径也没错,就是报不存在,服了。工具版本v1.02.1809260。 手动上传不存在问题。命令行用不成啊。 无论是预览,还是上传,都是同样的bug。 看看是不是我路径有问题: >cli -u 1.1.3@\F:\work\fe-test\dist\fe-test --upload-desc 'test cli' ------------------- 追加: 终于搞定了,应当是路径的问题。注意,命令输入过程不要有任何的光标返回修改操作。一次到位就没问题,修改到位也会失败。
CLI调用报错- 当前 Bug 的表现(可附上截图) 同样的一个project.config.json,使用cli调用失败,手动用开发者工具打开就可以。 [图片] - 预期表现 使用cli调用可以正确打开小程序。 - 复现路径 [代码]{[代码][代码] [代码][代码]"description"[代码][代码]: [代码][代码]"项目配置文件"[代码][代码],[代码][代码] [代码][代码]"packOptions"[代码][代码]: {[代码][代码] [代码][代码]"ignore"[代码][代码]: [][代码][代码] [代码][代码]},[代码][代码] [代码][代码]"setting"[代码][代码]: {[代码][代码] [代码][代码]"urlCheck"[代码][代码]: [代码][代码]true[代码][代码],[代码][代码] [代码][代码]"es6"[代码][代码]: [代码][代码]false[代码][代码],[代码][代码] [代码][代码]"postcss"[代码][代码]: [代码][代码]true[代码][代码],[代码][代码] [代码][代码]"minified"[代码][代码]: [代码][代码]false[代码][代码],[代码][代码] [代码][代码]"newFeature"[代码][代码]: [代码][代码]true[代码][代码] [代码][代码]},[代码][代码] [代码][代码]"compileType"[代码][代码]: [代码][代码]"miniprogram"[代码][代码],[代码][代码] [代码][代码]"libVersion"[代码][代码]: [代码][代码]"2.3.2"[代码][代码],[代码][代码] [代码][代码]"appid"[代码][代码]: [代码][代码]"wxaf7296aa719f52e2"[代码][代码],[代码][代码] [代码][代码]"projectname"[代码][代码]: [代码][代码]"wxa-templates"[代码][代码],[代码][代码] [代码][代码]"miniprogramRoot"[代码][代码]: [代码][代码]"base/dist/"[代码][代码],[代码][代码] [代码][代码]"debugOptions"[代码][代码]: {[代码][代码] [代码][代码]"hidedInDevtools"[代码][代码]: [][代码][代码] [代码][代码]},[代码][代码] [代码][代码]"isGameTourist"[代码][代码]: [代码][代码]false[代码][代码],[代码][代码] [代码][代码]"condition"[代码][代码]: {[代码][代码] [代码][代码]"search"[代码][代码]: {[代码][代码] [代码][代码]"current"[代码][代码]: -1,[代码][代码] [代码][代码]"list"[代码][代码]: [][代码][代码] [代码][代码]},[代码][代码] [代码][代码]"conversation"[代码][代码]: {[代码][代码] [代码][代码]"current"[代码][代码]: -1,[代码][代码] [代码][代码]"list"[代码][代码]: [][代码][代码] [代码][代码]},[代码][代码] [代码][代码]"game"[代码][代码]: {[代码][代码] [代码][代码]"currentL"[代码][代码]: -1,[代码][代码] [代码][代码]"list"[代码][代码]: [][代码][代码] [代码][代码]},[代码][代码] [代码][代码]"miniprogram"[代码][代码]: {[代码][代码] [代码][代码]"current"[代码][代码]: -1,[代码][代码] [代码][代码]"list"[代码][代码]: [][代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码]}[代码] - 提供一个最简复现 Demo
2018-11-01[代码]<template>[代码][代码] [代码][代码]<div>[代码][代码] [代码][代码]<navigator v-[代码][代码]if[代码][代码]=[代码][代码]"canIUseNavigator"[代码] [代码]:class=[代码][代码]"className"[代码] [代码]:target=[代码][代码]"target"[代码] [代码]:app-id=[代码][代码]"appId"[代码] [代码]:open-type=[代码][代码]"openType"[代码] [代码]:path=[代码][代码]"path"[代码] [代码]:extra-data=[代码][代码]"extraData"[代码] [代码]:version=[代码][代码]"version"[代码][代码]>[代码][代码] [代码][代码]<slot></slot>[代码][代码] [代码][代码]</navigator>[代码][代码] [代码][代码]<div v-[代码][代码]else[代码] [代码]:class=[代码][代码]"className"[代码] [代码]@click=[代码][代码]"gotoMiniProgram"[代码][代码]>[代码][代码] [代码][代码]<slot></slot>[代码][代码] [代码][代码]</div>[代码][代码] [代码][代码]</div>[代码][代码]</template>[代码] [代码]<script>[代码][代码]/** [代码][代码]* 注意mpvue暂时不支持slot(scoped)[代码][代码]*/[代码][代码]const app = getApp();[代码][代码]export [代码][代码]default[代码] [代码]{[代码][代码] [代码][代码]/**[代码][代码] [代码][代码]* 页面所需数据[代码][代码] [代码][代码]* @return {Object} 页面数据[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]data: [代码][代码]function[代码][代码]() {[代码][代码] [代码][代码]return[代码] [代码]{[代码][代码] [代码][代码]canIUseNavigator: [代码][代码]false[代码] [代码]// 是否启用navigator组件,根据基础版本号判断是否大于2.0.7[代码][代码] [代码][代码]};[代码][代码] [代码][代码]},[代码][代码] [代码][代码]props: {[代码][代码] [代码][代码]className: String,[代码][代码] [代码][代码]target: String,[代码][代码] [代码][代码]openType: String,[代码][代码] [代码][代码]appId: String,[代码][代码] [代码][代码]path: String,[代码][代码] [代码][代码]extraData: Object,[代码][代码] [代码][代码]version: String[代码][代码] [代码][代码]},[代码][代码] [代码][代码]/**[代码][代码] [代码][代码]* 页面初始化,获取版本信息[代码][代码] [代码][代码]* @return {Void} 无[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]mounted: [代码][代码]function[代码][代码]() {[代码][代码] [代码][代码]wx.getSystemInfo({[代码][代码] [代码][代码]success: res => {[代码][代码] [代码][代码]console.log(res.SDKVersion);[代码][代码] [代码][代码]let baseVersion = res.SDKVersion.split([代码][代码]"."[代码][代码]).join([代码][代码]""[代码][代码]) - 0;[代码][代码] [代码][代码]if[代码] [代码](baseVersion >= 207) {[代码][代码] [代码][代码]console.log([代码][代码]"使用navigator组件打开小程序"[代码][代码]);[代码][代码] [代码][代码]this[代码][代码].canIUseNavigator = [代码][代码]true[代码][代码];[代码][代码] [代码][代码]} [代码][代码]else[代码] [代码]{[代码][代码] [代码][代码]console.log([代码][代码]"使用wx.navigateToMiniProgram方法打开小程序"[代码][代码]);[代码][代码] [代码][代码]this[代码][代码].canIUseNavigator = [代码][代码]false[代码][代码];[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码] [代码][代码]});[代码][代码] [代码][代码]},[代码][代码] [代码][代码]methods: {[代码][代码] [代码][代码]/**[代码][代码] [代码][代码]* 小程序跳转,基础库低于2.0.7版本使用[代码][代码] [代码][代码]* @return {Void} 无[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]gotoMiniProgram() {[代码][代码] [代码][代码]wx.navigateToMiniProgram({[代码][代码] [代码][代码]appId: [代码][代码]this[代码][代码].appId,[代码][代码] [代码][代码]path: [代码][代码]this[代码][代码].path,[代码][代码] [代码][代码]extraData: [代码][代码]this[代码][代码].extraData || [代码][代码]null[代码][代码],[代码][代码] [代码][代码]envVersion: [代码][代码]this[代码][代码].version,[代码][代码] [代码][代码]success: () => {[代码][代码] [代码][代码]console.log(`appId为:${[代码][代码]this[代码][代码].appId}的小程序被打开`);[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail: () => {[代码][代码] [代码][代码]console.log(`appId为:${[代码][代码]this[代码][代码].appId}的小程序打开失败`);[代码][代码] [代码][代码]}[代码][代码] [代码][代码]});[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码]};[代码][代码]</script>[代码]基于mpvue开发,提供一下思路。 暂时不可以用wx.canIUse进行判断。
navigateToMiniProgram变更的低版本兼容wx.navigateToMiniProgram接口即将废弃,转为使用navigator组件,但是版本最低要求2.0.7,@官方,请问对于低版本的我怎么做兼容呢?
2018-07-02