uniapp 采用按照官网文档集成离线打包,出现点击图标无法打开应用情况,后台报找不到类io.dcloud.PandoraEntryActivity,另外uniapp离线打包不显示上部导航栏问题
问题:1.uniapp 采用按照官网文档文档教程集成离线打包,出现点击图标无法打开应用情况,后台报找不到类io.dcloud.PandoraEntryActivity,
解决:在AndroidManifest.xml文件添加这部分代码,这个官网文档教程并未指出。
<activity
android:name="io.dcloud.PandoraEntryActivity"
android:launchMode="singleTask"
android:configChanges="orientation|keyboardHidden|screenSize|mcc|mnc|fontScale|keyboard"
android:hardwareAccelerated="true"
android:permission="com.miui.securitycenter.permission.AppPermissionsEditor"
android:screenOrientation="user"
android:theme="@style/DCloudTheme"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<action android:name="android.intent.action.VIEW" />
<data android:scheme="h56131bcf" />
</intent-filter>
</activity>
问题 2:. uniapp离线打包不显示上部导航栏,
解决:是需要加入android-gif-drawable-release@1.2.17.aar插件 ;这个是参考zyfking@hotmail.com 提供的方案的解决的,链接:https://ask.dcloud.net.cn/question/77861
问题:1.uniapp 采用按照官网文档文档教程集成离线打包,出现点击图标无法打开应用情况,后台报找不到类io.dcloud.PandoraEntryActivity,
解决:在AndroidManifest.xml文件添加这部分代码,这个官网文档教程并未指出。
<activity
android:name="io.dcloud.PandoraEntryActivity"
android:launchMode="singleTask"
android:configChanges="orientation|keyboardHidden|screenSize|mcc|mnc|fontScale|keyboard"
android:hardwareAccelerated="true"
android:permission="com.miui.securitycenter.permission.AppPermissionsEditor"
android:screenOrientation="user"
android:theme="@style/DCloudTheme"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<action android:name="android.intent.action.VIEW" />
<data android:scheme="h56131bcf" />
</intent-filter>
</activity>
问题 2:. uniapp离线打包不显示上部导航栏,
解决:是需要加入android-gif-drawable-release@1.2.17.aar插件 ;这个是参考zyfking@hotmail.com 提供的方案的解决的,链接:https://ask.dcloud.net.cn/question/77861
IOS上下拖动背景色(白色),修改方法
解决代码如下:
VUE-页面:
<template>
<view :class="'content ' + Skin">
<image class="img_background"></image>
CSS-样式:
.img_background{
z-index: -1;
width: 100%;
height: 100%;
position: fixed;
top: 0;
background-color: #1e2c35; // 其它颜色
// 背景图片
/* background: url('http://m.360buyimg.com/marketingminiapp/jfs/t23068/25/834363295/3013355/77286696/5b459faaN3f3bc27f.png') no-repeat; */
/* background-size: cover; */
}
修改前后对照(看附件):
解决代码如下:
VUE-页面:
<template>
<view :class="'content ' + Skin">
<image class="img_background"></image>
CSS-样式:
.img_background{
z-index: -1;
width: 100%;
height: 100%;
position: fixed;
top: 0;
background-color: #1e2c35; // 其它颜色
// 背景图片
/* background: url('http://m.360buyimg.com/marketingminiapp/jfs/t23068/25/834363295/3013355/77286696/5b459faaN3f3bc27f.png') no-repeat; */
/* background-size: cover; */
}
修改前后对照(看附件):
收起阅读 »自定义tabbar,支持H5,app,微信小程序中间凸起,支持uni.switchTab()跳转
浏览了很多关于uniapp的自定义tabbar的文章,很多感觉都写的不详细,而且跨端能力都不怎么样,我自己研究整理了一下:
跨端支持:H5、app、微信小程序,
H5效果图如下:
微信小程序效果图如下:
app的效果图没有截取到,但应该是可行的。
目录结构如下:
page.json的配置如下:
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页"
}
},{
"path": "pages/dynamic/dynamic",
"style": {
"navigationBarTitleText": "发现"
}
},{
"path": "pages/release/release",
"style": {
"navigationBarTitleText": "发布"
}
},{
"path": "pages/friend/friend",
"style": {
"navigationBarTitleText": "朋友"
}
},{
"path": "pages/mine/mine",
"style": {
"navigationBarTitleText": "我的"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"tabBar": {
"color": "#999999",
"selectedColor": "#66CCFF",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"midButton": {
"text": "发布",
"pagePath": "pages/release/release",
"iconPath": "static/images/tabbar/release.png",
"selectedIconPath": "static/images/tabbar/release-select.png"
},
"list": [{
"pagePath": "pages/index/index",
"iconPath": "static/images/tabbar/index.png",
"selectedIconPath": "static/images/tabbar/index-select.png",
"text": "首页"
},{
"pagePath": "pages/dynamic/dynamic",
"iconPath": "static/images/tabbar/dynamic.png",
"selectedIconPath": "static/images/tabbar/dynamic-select.png",
"text": "发现"
},
// #ifndef APP-PLUS
{
"pagePath": "pages/release/release",
"iconPath": "static/images/tabbar/release.png",
"selectedIconPath": "static/images/tabbar/release-select.png",
"text": "发布"
},
// #endif
{
"pagePath": "pages/friend/friend",
"iconPath": "static/images/tabbar/friend.png",
"selectedIconPath": "static/images/tabbar/friend-select.png",
"text": "朋友"
},{
"pagePath": "pages/mine/mine",
"iconPath": "static/images/tabbar/mine.png",
"selectedIconPath": "static/images/tabbar/mine-select.png",
"text": "我的"
}]
}
}
注册全局组件tabbar在main.js文件中,配置如下:
import Vue from 'vue'
import App from './App'
import rwjTabbar from './components/rwj-tabbar.vue'
Vue.config.productionTip = false
//注册全局组件
Vue.component('rwj-tabbar', rwjTabbar);
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()
rwj-tabbar.vue文件编写:
<template>
<view class="tabbar-container">
<block>
<view class="tabbar-item" v-for="(item,index) in tabbarList" :class="[item.centerItem ? ' center-item' : '']" @click="changeItem(item)">
<view class="item-top">
<image :src="currentItem==item.id?item.selectIcon:item.icon"></image>
</view>
<view class="item-bottom" :class="[currentItem==item.id ? 'item-active' : '']">
<text>{{item.text}}</text>
</view>
</view>
</block>
</view>
</template>
<script>
export default {
props:{
currentPage: {
type: Number,
default: 0
}
},
data() {
return {
currentItem: 0,
tabbarList: [
{
id: 0,
path: "/pages/index/index",
icon: "/static/images/tabbar/index.png",
selectIcon: "/static/images/tabbar/index-select.png",
text: "首页",
centerItem: false
},{
id: 1,
path: "/pages/dynamic/dynamic",
icon: "/static/images/tabbar/dynamic.png",
selectIcon: "/static/images/tabbar/dynamic-select.png",
text: "动态",
centerItem: false
},{
id: 2,
path: "/pages/release/release",
icon: "/static/images/tabbar/release.png",
selectIcon: "/static/images/tabbar/release-select.png",
text: "发布",
centerItem: true
},{
id: 3,
path: "/pages/friend/friend",
icon: "/static/images/tabbar/friend.png",
selectIcon: "/static/images/tabbar/friend-select.png",
text: "朋友",
centerItem: false
},{
id: 4,
path: "/pages/mine/mine",
icon: "/static/images/tabbar/mine.png",
selectIcon: "/static/images/tabbar/mine-select.png",
text: "我的",
centerItem: false
}
]
};
},
mounted(){
this.currentItem = this.currentPage;
uni.hideTabBar();
},
methods: {
changeItem(item){
let _this = this;
//_this.currentItem = item.id;
uni.switchTab({
url: item.path
});
}
}
}
</script>
<style>
view{
padding: 0;
margin: 0;
box-sizing: border-box;
}
.tabbar-container{
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 110rpx;
box-shadow: 0 0 5px #999;
display: flex;
align-items: center;
padding: 5rpx 0;
color: #999999;
}
.tabbar-container .tabbar-item{
width: 20%;
height: 100rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
}
.tabbar-container .item-active{
color: #66CCFF;
}
.tabbar-container .center-item{
display: block;
position: relative;
}
.tabbar-container .tabbar-item .item-top{
width: 70rpx;
height: 70rpx;
padding: 10rpx;
}
.tabbar-container .center-item .item-top{
flex-shrink: 0;
width: 100rpx;
height: 100rpx;
position: absolute;
top: -50rpx;
left: calc(50% - 50rpx);
border-radius: 50%;
box-shadow: 0 0 5px #999;
background-color: #ffffff;
}
.tabbar-container .tabbar-item .item-top image{
width: 100%;
height: 100%;
}
.tabbar-container .tabbar-item .item-bottom{
font-size: 28rpx;
width: 100%;
}
.tabbar-container .center-item .item-bottom{
position: absolute;
bottom: 5rpx;
}
</style>
index.vue文件中引入tabbar:
<!-- #ifndef APP-PLUS -->
<rwj-tabbar :current-page="0"></rwj-tabbar>
<!-- #endif -->
补充说明:
由于app端不支持uni.hideTabBar();,所以在app端不需要使用自定义组件,而且app端uniapp原生的就支持中间凸起,所以app是使用的原生的tabbar
浏览了很多关于uniapp的自定义tabbar的文章,很多感觉都写的不详细,而且跨端能力都不怎么样,我自己研究整理了一下:
跨端支持:H5、app、微信小程序,
H5效果图如下:
微信小程序效果图如下:
app的效果图没有截取到,但应该是可行的。
目录结构如下:
page.json的配置如下:
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页"
}
},{
"path": "pages/dynamic/dynamic",
"style": {
"navigationBarTitleText": "发现"
}
},{
"path": "pages/release/release",
"style": {
"navigationBarTitleText": "发布"
}
},{
"path": "pages/friend/friend",
"style": {
"navigationBarTitleText": "朋友"
}
},{
"path": "pages/mine/mine",
"style": {
"navigationBarTitleText": "我的"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"tabBar": {
"color": "#999999",
"selectedColor": "#66CCFF",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"midButton": {
"text": "发布",
"pagePath": "pages/release/release",
"iconPath": "static/images/tabbar/release.png",
"selectedIconPath": "static/images/tabbar/release-select.png"
},
"list": [{
"pagePath": "pages/index/index",
"iconPath": "static/images/tabbar/index.png",
"selectedIconPath": "static/images/tabbar/index-select.png",
"text": "首页"
},{
"pagePath": "pages/dynamic/dynamic",
"iconPath": "static/images/tabbar/dynamic.png",
"selectedIconPath": "static/images/tabbar/dynamic-select.png",
"text": "发现"
},
// #ifndef APP-PLUS
{
"pagePath": "pages/release/release",
"iconPath": "static/images/tabbar/release.png",
"selectedIconPath": "static/images/tabbar/release-select.png",
"text": "发布"
},
// #endif
{
"pagePath": "pages/friend/friend",
"iconPath": "static/images/tabbar/friend.png",
"selectedIconPath": "static/images/tabbar/friend-select.png",
"text": "朋友"
},{
"pagePath": "pages/mine/mine",
"iconPath": "static/images/tabbar/mine.png",
"selectedIconPath": "static/images/tabbar/mine-select.png",
"text": "我的"
}]
}
}
注册全局组件tabbar在main.js文件中,配置如下:
import Vue from 'vue'
import App from './App'
import rwjTabbar from './components/rwj-tabbar.vue'
Vue.config.productionTip = false
//注册全局组件
Vue.component('rwj-tabbar', rwjTabbar);
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()
rwj-tabbar.vue文件编写:
<template>
<view class="tabbar-container">
<block>
<view class="tabbar-item" v-for="(item,index) in tabbarList" :class="[item.centerItem ? ' center-item' : '']" @click="changeItem(item)">
<view class="item-top">
<image :src="currentItem==item.id?item.selectIcon:item.icon"></image>
</view>
<view class="item-bottom" :class="[currentItem==item.id ? 'item-active' : '']">
<text>{{item.text}}</text>
</view>
</view>
</block>
</view>
</template>
<script>
export default {
props:{
currentPage: {
type: Number,
default: 0
}
},
data() {
return {
currentItem: 0,
tabbarList: [
{
id: 0,
path: "/pages/index/index",
icon: "/static/images/tabbar/index.png",
selectIcon: "/static/images/tabbar/index-select.png",
text: "首页",
centerItem: false
},{
id: 1,
path: "/pages/dynamic/dynamic",
icon: "/static/images/tabbar/dynamic.png",
selectIcon: "/static/images/tabbar/dynamic-select.png",
text: "动态",
centerItem: false
},{
id: 2,
path: "/pages/release/release",
icon: "/static/images/tabbar/release.png",
selectIcon: "/static/images/tabbar/release-select.png",
text: "发布",
centerItem: true
},{
id: 3,
path: "/pages/friend/friend",
icon: "/static/images/tabbar/friend.png",
selectIcon: "/static/images/tabbar/friend-select.png",
text: "朋友",
centerItem: false
},{
id: 4,
path: "/pages/mine/mine",
icon: "/static/images/tabbar/mine.png",
selectIcon: "/static/images/tabbar/mine-select.png",
text: "我的",
centerItem: false
}
]
};
},
mounted(){
this.currentItem = this.currentPage;
uni.hideTabBar();
},
methods: {
changeItem(item){
let _this = this;
//_this.currentItem = item.id;
uni.switchTab({
url: item.path
});
}
}
}
</script>
<style>
view{
padding: 0;
margin: 0;
box-sizing: border-box;
}
.tabbar-container{
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 110rpx;
box-shadow: 0 0 5px #999;
display: flex;
align-items: center;
padding: 5rpx 0;
color: #999999;
}
.tabbar-container .tabbar-item{
width: 20%;
height: 100rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
}
.tabbar-container .item-active{
color: #66CCFF;
}
.tabbar-container .center-item{
display: block;
position: relative;
}
.tabbar-container .tabbar-item .item-top{
width: 70rpx;
height: 70rpx;
padding: 10rpx;
}
.tabbar-container .center-item .item-top{
flex-shrink: 0;
width: 100rpx;
height: 100rpx;
position: absolute;
top: -50rpx;
left: calc(50% - 50rpx);
border-radius: 50%;
box-shadow: 0 0 5px #999;
background-color: #ffffff;
}
.tabbar-container .tabbar-item .item-top image{
width: 100%;
height: 100%;
}
.tabbar-container .tabbar-item .item-bottom{
font-size: 28rpx;
width: 100%;
}
.tabbar-container .center-item .item-bottom{
position: absolute;
bottom: 5rpx;
}
</style>
index.vue文件中引入tabbar:
<!-- #ifndef APP-PLUS -->
<rwj-tabbar :current-page="0"></rwj-tabbar>
<!-- #endif -->
补充说明:
由于app端不支持uni.hideTabBar();,所以在app端不需要使用自定义组件,而且app端uniapp原生的就支持中间凸起,所以app是使用的原生的tabbar
ios审核一周搞定,分享下过程
正好遇到国外圣诞节,中间有一周的空档,所以这里说的一周是扣除圣诞节放假的,我的app提交赶在他们的节前。累计被驳回5回,每次一天(23号他们给我驳回了2次)。
这里就说下需要注意的地方:
1、必须要隐私条款连接;
2、6.5英寸的预览和截屏得有留海(这个是看到别人说的,就我们修改了下,所以没因为截屏被驳回);
3、标题和副标题这个要特别注意。看appstore中很多标题都是带附加说明的,但是现在应该是不允许的。我们提交的app被驳回3次都是因为标题和副标题的原因:
a、第一次提交时,副标题添加了 一段说明他们认为是有关键词堆砌嫌疑,所以驳回了;
b、第二次我们将副标题的说明修改了,然后在增加了app名称的附加说明 “ app名称 - abc”,在appstore上可以看见很多类似的写法,不过那是以前现在貌似不行(反正被驳回了2次就不想再试了);
c、第三次我们去除了app名称上的附加说明“ - 附加说明”只留下单纯的app名称,然后附加标题采用“「app名称」期货交易数据分析与排名”,并说明为啥要用这个,接着跟他们商量我是否可以保留这个;
d、又一次被驳回,不过这次他们让我保留副标题说明了,驳回的原因是因为用户上传头像要权限,这个权限我没说明。在manifest.json中的“APP模块权限配置”中的“ios隐私信息访问的许可描述”添加说明后重新编译一个版本提交了上去。
e、最后一次被驳回,说我的副标题“「app名称」期货交易数据分析与排名”不符合政策。我在回复中把上次说明的情况再跟他说了一遍,并询问是否是同一个人审核的。最后问他,如果这个说明不符合政策,能否给个建议。这次提交上去后他们给通过了。
我感觉最主要的还是要尊重他们,我每次回复总是心平气和,因为这个其实是他们的工作,没必要耍小脾气。但是并不是说要低三下气,只是陈述事实即可。其实看下我们的副标题“期货交易数据分析与排名”,这个本身确实很难说没关键词堆砌嫌疑,因为含有“期货交易”,但是跟他们说明情况后他们放行了。
正好遇到国外圣诞节,中间有一周的空档,所以这里说的一周是扣除圣诞节放假的,我的app提交赶在他们的节前。累计被驳回5回,每次一天(23号他们给我驳回了2次)。
这里就说下需要注意的地方:
1、必须要隐私条款连接;
2、6.5英寸的预览和截屏得有留海(这个是看到别人说的,就我们修改了下,所以没因为截屏被驳回);
3、标题和副标题这个要特别注意。看appstore中很多标题都是带附加说明的,但是现在应该是不允许的。我们提交的app被驳回3次都是因为标题和副标题的原因:
a、第一次提交时,副标题添加了 一段说明他们认为是有关键词堆砌嫌疑,所以驳回了;
b、第二次我们将副标题的说明修改了,然后在增加了app名称的附加说明 “ app名称 - abc”,在appstore上可以看见很多类似的写法,不过那是以前现在貌似不行(反正被驳回了2次就不想再试了);
c、第三次我们去除了app名称上的附加说明“ - 附加说明”只留下单纯的app名称,然后附加标题采用“「app名称」期货交易数据分析与排名”,并说明为啥要用这个,接着跟他们商量我是否可以保留这个;
d、又一次被驳回,不过这次他们让我保留副标题说明了,驳回的原因是因为用户上传头像要权限,这个权限我没说明。在manifest.json中的“APP模块权限配置”中的“ios隐私信息访问的许可描述”添加说明后重新编译一个版本提交了上去。
e、最后一次被驳回,说我的副标题“「app名称」期货交易数据分析与排名”不符合政策。我在回复中把上次说明的情况再跟他说了一遍,并询问是否是同一个人审核的。最后问他,如果这个说明不符合政策,能否给个建议。这次提交上去后他们给通过了。
我感觉最主要的还是要尊重他们,我每次回复总是心平气和,因为这个其实是他们的工作,没必要耍小脾气。但是并不是说要低三下气,只是陈述事实即可。其实看下我们的副标题“期货交易数据分析与排名”,这个本身确实很难说没关键词堆砌嫌疑,因为含有“期货交易”,但是跟他们说明情况后他们放行了。
收起阅读 »【数位云】开放平台上线,共建位置服务生态~欢迎体验
12月13日,数位宣布即将上线位置服务开发者平台,面向行业开发者赋能采集、定位等基础能力,支持安卓、iOS、小程序等不同平台,帮助行业缩短开发周期,节省开发成本,以更高效的方式获取领先的精准室内位置识别能力。
定 位
基于数位自主研发的核心专利技术,赋能开发者店铺级精准室内位置识别能力,可以在不依赖硬件铺设的前提下,精准区分楼层、店铺、店内及店外。目前,这一定位能力已覆盖全国209座城市超4000万高价值室内场景并不断扩张,为开发者搭建精准室内定位能力通用平台。
采 集
针对不同行业面向的场景差异,数位开发者平台为开发者提供目标场景自采集功能,将原本专业采集团队才能完成的系统性采集工作,面向行业零门槛开放。开发者只需到达符合采集标准的目标采集地点,通过APP进行2步操作,10秒即可获取目标场景的精准定位能力。
目前,数位定位+采集能力已经为本地生活、新闻资讯、视频娱乐、电商母婴、考勤办公等诸多领域的服务类、工具类、娱乐类APP提供服务,赋能人员管理、定位打卡、用户画像、场景服务、数据分析、精细化运营等多种能力,打造从采集到定位,从定位到场景服务,从服务到数据分析的一整套位置服务系统。
即日起,开发者可联系数位工作人员获取免费体验工具。
未来,数位还将陆续开放地图导航、近场服务、数据分析等能力,丰富位置服务形态,构建位置服务生态,与行业共建全域感知的智能世界。
开发者平台链接地址:https://cloud.papakaka.com/flash/#/dashboard
体验中如有疑问
扫描或识别下方二维码
添加数位小助手
随时在线解答您的问题
12月13日,数位宣布即将上线位置服务开发者平台,面向行业开发者赋能采集、定位等基础能力,支持安卓、iOS、小程序等不同平台,帮助行业缩短开发周期,节省开发成本,以更高效的方式获取领先的精准室内位置识别能力。
定 位
基于数位自主研发的核心专利技术,赋能开发者店铺级精准室内位置识别能力,可以在不依赖硬件铺设的前提下,精准区分楼层、店铺、店内及店外。目前,这一定位能力已覆盖全国209座城市超4000万高价值室内场景并不断扩张,为开发者搭建精准室内定位能力通用平台。
采 集
针对不同行业面向的场景差异,数位开发者平台为开发者提供目标场景自采集功能,将原本专业采集团队才能完成的系统性采集工作,面向行业零门槛开放。开发者只需到达符合采集标准的目标采集地点,通过APP进行2步操作,10秒即可获取目标场景的精准定位能力。
目前,数位定位+采集能力已经为本地生活、新闻资讯、视频娱乐、电商母婴、考勤办公等诸多领域的服务类、工具类、娱乐类APP提供服务,赋能人员管理、定位打卡、用户画像、场景服务、数据分析、精细化运营等多种能力,打造从采集到定位,从定位到场景服务,从服务到数据分析的一整套位置服务系统。
即日起,开发者可联系数位工作人员获取免费体验工具。
未来,数位还将陆续开放地图导航、近场服务、数据分析等能力,丰富位置服务形态,构建位置服务生态,与行业共建全域感知的智能世界。
开发者平台链接地址:https://cloud.papakaka.com/flash/#/dashboard
体验中如有疑问
扫描或识别下方二维码
添加数位小助手
随时在线解答您的问题
【建议】ctrl+f搜索结果总是在画面最下面或最上面,很不明显不便于查看代码上下文。
ctrl+f搜索结果总是在画面最下面或最上面,很不明显不便于查看代码上下文。
能否将结果高亮显示在中间,这样比较明显,且方便用户查看关键词的上下文,以便用户分别是否是想要的结果。
感谢!
ctrl+f搜索结果总是在画面最下面或最上面,很不明显不便于查看代码上下文。
能否将结果高亮显示在中间,这样比较明显,且方便用户查看关键词的上下文,以便用户分别是否是想要的结果。
感谢!
【建议】需要回到上个编辑位置的功能。感谢
alt+方向 通常要按好多次效率非常低。希望增加编辑位置的跳转,类似目前光标位置的跳转,只不过是历史编辑位置的跳转。感谢!
alt+方向 通常要按好多次效率非常低。希望增加编辑位置的跳转,类似目前光标位置的跳转,只不过是历史编辑位置的跳转。感谢!
Nvue 首页快速启动模式
v3编译模式(HBuilderX 2.5.0+),支持 nvue 首页的快速启动,视图层层不等逻辑层初始化完毕,即可同时进行渲染。
启用方式
在 manifest.json 可视化视图,app其他常用设置里,勾上fast启动模式。
或者在 manifest.json 源码视图里 app-plus 节点下配置 nvueLaunchMode 为 fast。
注意事项
启用快速启动模式后,app启动时,逻辑层和首页视图层是同时初始化的。(非fast模式时,是逻辑层先初始化,然后才开始加载视图层)
由于视图层渲染时,逻辑层不一定初始化完毕,此时首页的nvue页面内不可以依赖逻辑层的状态,具体为:
- 纯nvue + fast,vuex可用
- V3 + fast,vuex不可用
- getApp() 使用存在限制,具体参考:getApp()
v3编译模式(HBuilderX 2.5.0+),支持 nvue 首页的快速启动,视图层层不等逻辑层初始化完毕,即可同时进行渲染。
启用方式
在 manifest.json 可视化视图,app其他常用设置里,勾上fast启动模式。
或者在 manifest.json 源码视图里 app-plus 节点下配置 nvueLaunchMode 为 fast。
注意事项
启用快速启动模式后,app启动时,逻辑层和首页视图层是同时初始化的。(非fast模式时,是逻辑层先初始化,然后才开始加载视图层)
由于视图层渲染时,逻辑层不一定初始化完毕,此时首页的nvue页面内不可以依赖逻辑层的状态,具体为:
- 纯nvue + fast,vuex可用
- V3 + fast,vuex不可用
- getApp() 使用存在限制,具体参考:getApp()
开启 optional chaining 语法
我是使用 uni-cli 构建的,所以开启 optional-chaining 语法只需要安装了@babel/plugin-proposal-optional-chaining 包后在项目下的 babel.config.js 中配置
const plugins = ["@babel/plugin-proposal-optional-chaining"];
就是在 plugins 中加上@babel/plugin-proposal-optional-chaining 就好了,但是有些玄学问题,昨天搞了半天这个语法都不能用各种报错,今天啥也没改重新开机就能用了。。。。
也就是说这样配置是没问题的,还报错就重启试试?
我是使用 uni-cli 构建的,所以开启 optional-chaining 语法只需要安装了@babel/plugin-proposal-optional-chaining 包后在项目下的 babel.config.js 中配置
const plugins = ["@babel/plugin-proposal-optional-chaining"];
就是在 plugins 中加上@babel/plugin-proposal-optional-chaining 就好了,但是有些玄学问题,昨天搞了半天这个语法都不能用各种报错,今天啥也没改重新开机就能用了。。。。
也就是说这样配置是没问题的,还报错就重启试试?
收起阅读 »APP读取本地文件夹内视频播放
需要用到的几个方法:
// 从本地缓存中同步获取指定 key 对应的内容。
uni.getStorageSync(KEY)
// 下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。
uni.downloadFile(OBJECT)
// 保存视频到本地
uni.saveFile(OBJECT)
// 将 data 存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个同步接口。
uni.setStorageSync(KEY,DATA)
首先定义一个变量:获取本地缓存数据,看本地视频是存在。
获取已下载视频目录中的视频列表,删除无关视频。
const videoData = uni.getStorageSync('videoData')
// 获取本地视频列表
uni.getSavedFileList({
success: function (res) {
let fileList = res.fileList
console.log(fileList);
let needArr = videoData.map(item => item.videoAddress)
fileList.forEach((item, index) => {
if(needArr.includes(item.filePath)){
item.text = "需要这个视频"
}else{
// 删除视频列表中无关视频
uni.removeSavedFile({
filePath: item.filePath,
complete: function (res) {
console.log(res);
}
});
}
});
console.log(fileList)
}
});
写个条件判断:如果存在直接将视频地址插入页面进行播放,如果不存在则进行下载视频-保存视频-缓存本地链接。
const _this = this;
// 判断是否有缓存
if(videoData){
console.log('我是视频-有缓存')
_this.videoSrc = videoData
}else{
console.log('我是视频-没有有缓存')
_this.videoSrc = url // 我是在线链接
// 下载视频
_this.downFile(videoUrlYi,'videoData');
}
// 下载视频
downFile(url,name){
const _this = this;
uni.downloadFile({
url: url,
success: (res) => {
if (res.statusCode === 200) {
console.log('下载成功');
console.log(res.tempFilePath)
//保存视频到本地
uni.saveFile({
tempFilePath: res.tempFilePath,
success: function (res) {
console.log('保存成功');
var savedFilePath = res.savedFilePath;
console.log(savedFilePath)
_this.videoSrc = savedFilePath
console.log('当前连接'+_this.videoSrc)
uni.setStorageSync(name, savedFilePath);
}
});
}
}
});
}
小编推荐:程序员网址导航
作为一名码农,随着平时工作的需要,这里收集了国内外很多优秀网站,这其中包括在线工具、在线运行、免费接口、在线资源、在线学习、技术论坛、技术博客等等,满足一般程序员日常需求。
需要用到的几个方法:
// 从本地缓存中同步获取指定 key 对应的内容。
uni.getStorageSync(KEY)
// 下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。
uni.downloadFile(OBJECT)
// 保存视频到本地
uni.saveFile(OBJECT)
// 将 data 存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个同步接口。
uni.setStorageSync(KEY,DATA)
首先定义一个变量:获取本地缓存数据,看本地视频是存在。
获取已下载视频目录中的视频列表,删除无关视频。
const videoData = uni.getStorageSync('videoData')
// 获取本地视频列表
uni.getSavedFileList({
success: function (res) {
let fileList = res.fileList
console.log(fileList);
let needArr = videoData.map(item => item.videoAddress)
fileList.forEach((item, index) => {
if(needArr.includes(item.filePath)){
item.text = "需要这个视频"
}else{
// 删除视频列表中无关视频
uni.removeSavedFile({
filePath: item.filePath,
complete: function (res) {
console.log(res);
}
});
}
});
console.log(fileList)
}
});
写个条件判断:如果存在直接将视频地址插入页面进行播放,如果不存在则进行下载视频-保存视频-缓存本地链接。
const _this = this;
// 判断是否有缓存
if(videoData){
console.log('我是视频-有缓存')
_this.videoSrc = videoData
}else{
console.log('我是视频-没有有缓存')
_this.videoSrc = url // 我是在线链接
// 下载视频
_this.downFile(videoUrlYi,'videoData');
}
// 下载视频
downFile(url,name){
const _this = this;
uni.downloadFile({
url: url,
success: (res) => {
if (res.statusCode === 200) {
console.log('下载成功');
console.log(res.tempFilePath)
//保存视频到本地
uni.saveFile({
tempFilePath: res.tempFilePath,
success: function (res) {
console.log('保存成功');
var savedFilePath = res.savedFilePath;
console.log(savedFilePath)
_this.videoSrc = savedFilePath
console.log('当前连接'+_this.videoSrc)
uni.setStorageSync(name, savedFilePath);
}
});
}
}
});
}
小编推荐:程序员网址导航
收起阅读 »作为一名码农,随着平时工作的需要,这里收集了国内外很多优秀网站,这其中包括在线工具、在线运行、免费接口、在线资源、在线学习、技术论坛、技术博客等等,满足一般程序员日常需求。