From b3726a5e897e6d04259c58a5932de8827a966cb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=A3=8A?= Date: Mon, 10 Dec 2018 14:38:02 +0800 Subject: [PATCH] omi-mp - supports wx.navigateBack & remove gulp-watch --- packages/omi-cli/package.json | 2 +- packages/omi-cli/template/mp/gulpfile.js | 3 +-- packages/omi-cli/template/mp/package.json | 1 - packages/omi-cli/template/mp/src/utils/mp.js | 4 ++++ packages/omi-mp-douban/gulpfile.js | 3 +-- packages/omi-mp-douban/package.json | 1 - packages/omi-mp-douban/src/utils/mp.js | 4 ++++ packages/omi-mp/src/utils/mp.js | 4 ++++ 8 files changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/omi-cli/package.json b/packages/omi-cli/package.json index c1827adfa..d61421b12 100755 --- a/packages/omi-cli/package.json +++ b/packages/omi-cli/package.json @@ -1,6 +1,6 @@ { "name": "omi-cli", - "version": "3.0.30", + "version": "3.0.31", "description": "Create website with no build configuration. be friendly to [Omi](https://github.com/Tencent/omi) framework.", "main": "bin/omi", "engines": { diff --git a/packages/omi-cli/template/mp/gulpfile.js b/packages/omi-cli/template/mp/gulpfile.js index 281f2ae17..0524dcea0 100644 --- a/packages/omi-cli/template/mp/gulpfile.js +++ b/packages/omi-cli/template/mp/gulpfile.js @@ -3,7 +3,6 @@ let path = require('path') let tap = require('gulp-tap') let compile = require('./scripts/mp/index') let fs = require('fs') -let watch = require('gulp-watch') let compileWxss = require('./scripts/mp/wxss') gulp.task('components', ['copy'], () => { @@ -200,7 +199,7 @@ gulp.task('copyThen', () => { }) gulp.task('watch', () => { - watch('src-mp/**/*', () => { + gulp.watch('src-mp/**/*', () => { gulp.start('copyThen') }) }) diff --git a/packages/omi-cli/template/mp/package.json b/packages/omi-cli/template/mp/package.json index dbba9111a..16c0a72c0 100644 --- a/packages/omi-cli/template/mp/package.json +++ b/packages/omi-cli/template/mp/package.json @@ -13,7 +13,6 @@ "css-what": "^2.1.2", "gulp": "^3.9.1", "gulp-tap": "^1.0.1", - "gulp-watch": "^5.0.1", "html2json": "^1.0.2", "uglify-js": "^3.4.9" }, diff --git a/packages/omi-cli/template/mp/src/utils/mp.js b/packages/omi-cli/template/mp/src/utils/mp.js index 978331429..3aec23fb9 100644 --- a/packages/omi-cli/template/mp/src/utils/mp.js +++ b/packages/omi-cli/template/mp/src/utils/mp.js @@ -68,6 +68,10 @@ wx.setNavigationBarTitle = function (option) { document.title = option.title } +wx.navigateBack = function (option) { + history.go(option.delta * -1) +} + function getUrlParams(url) { url = url.replace(/#.*$/, '') var queryArray = url.split(/[?&]/).slice(1) diff --git a/packages/omi-mp-douban/gulpfile.js b/packages/omi-mp-douban/gulpfile.js index 281f2ae17..0524dcea0 100644 --- a/packages/omi-mp-douban/gulpfile.js +++ b/packages/omi-mp-douban/gulpfile.js @@ -3,7 +3,6 @@ let path = require('path') let tap = require('gulp-tap') let compile = require('./scripts/mp/index') let fs = require('fs') -let watch = require('gulp-watch') let compileWxss = require('./scripts/mp/wxss') gulp.task('components', ['copy'], () => { @@ -200,7 +199,7 @@ gulp.task('copyThen', () => { }) gulp.task('watch', () => { - watch('src-mp/**/*', () => { + gulp.watch('src-mp/**/*', () => { gulp.start('copyThen') }) }) diff --git a/packages/omi-mp-douban/package.json b/packages/omi-mp-douban/package.json index 1a4eafb08..6649db754 100644 --- a/packages/omi-mp-douban/package.json +++ b/packages/omi-mp-douban/package.json @@ -13,7 +13,6 @@ "css-what": "^2.1.2", "gulp": "^3.9.1", "gulp-tap": "^1.0.1", - "gulp-watch": "^5.0.1", "html2json": "^1.0.2", "uglify-js": "^3.4.9" }, diff --git a/packages/omi-mp-douban/src/utils/mp.js b/packages/omi-mp-douban/src/utils/mp.js index 978331429..3aec23fb9 100644 --- a/packages/omi-mp-douban/src/utils/mp.js +++ b/packages/omi-mp-douban/src/utils/mp.js @@ -68,6 +68,10 @@ wx.setNavigationBarTitle = function (option) { document.title = option.title } +wx.navigateBack = function (option) { + history.go(option.delta * -1) +} + function getUrlParams(url) { url = url.replace(/#.*$/, '') var queryArray = url.split(/[?&]/).slice(1) diff --git a/packages/omi-mp/src/utils/mp.js b/packages/omi-mp/src/utils/mp.js index 978331429..3aec23fb9 100644 --- a/packages/omi-mp/src/utils/mp.js +++ b/packages/omi-mp/src/utils/mp.js @@ -68,6 +68,10 @@ wx.setNavigationBarTitle = function (option) { document.title = option.title } +wx.navigateBack = function (option) { + history.go(option.delta * -1) +} + function getUrlParams(url) { url = url.replace(/#.*$/, '') var queryArray = url.split(/[?&]/).slice(1)