123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <script>
- export default {
- onLaunch: function() {
- console.log('App Launch');
- // 看小程序需不需更新
- this.initUpd();
- },
- onShow: function(options) {
- console.log('App Show');
- },
- onHide: function() {
- console.log('App Hide');
- },
- methods: {
- // 更新小程序
- initUpd() {
- //获取小程序更新机制兼容
- if (uni.canIUse('getUpdateManager')) {
- const updateManager = uni.getUpdateManager();
- updateManager.onCheckForUpdate(function(res) {
- // 请求完新版本信息的回调
- if (res.hasUpdate) {
- updateManager.onUpdateReady(function() {
- uni.showModal({
- title: '更新提示',
- content: '新版本已经准备好,是否重启应用?',
- showCancel: false,
- confirmColor: '#3c9cff',
- success: function(res) {
- if (res.confirm) {
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- updateManager.applyUpdate();
- }
- }
- });
- });
- updateManager.onUpdateFailed(function() {
- // 新的版本下载失败
- uni.showModal({
- title: '已经有新版本了哟~',
- content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
- });
- });
- }
- });
- } else {
- // 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示
- uni.showModal({
- title: '提示',
- content: '当前微信版本过低,无法更好体验程序,请升级到最新微信版本后重试。'
- });
- }
- }
- }
- };
- </script>
- <style lang="scss">
- /*每个页面公共css */
- @import '@/uni_modules/uview-ui/index.scss';
- @import 'static/style/css/common.scss';
- // 全部页面背景色
- page {
- background-color: #f4f4f4;
- width: 100%;
- height: 100%;
- }
- view,
- scroll-view,
- swiper,
- swiper-item,
- cover-view,
- cover-image,
- icon,
- text,
- rich-text,
- progress,
- button,
- checkbox,
- form,
- input,
- label,
- radio,
- slider,
- switch,
- textarea,
- navigator,
- audio,
- camera,
- image,
- video {
- box-sizing: border-box;
- font-size: 14px;
- }
- // 改变uview的步进器大小
- .chgUNumBox {
- /deep/ .u-number-box {
- width: 100% !important;
- }
- /deep/ .u-number-box__plus {
- width: 30% !important;
- }
- /deep/ .u-number-box__input {
- width: 40% !important;
- }
- /deep/ .u-number-box__minus {
- width: 30% !important;
- }
- }
- </style>
|