uni_android_plugin_project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

127 lines
2.9 KiB

<template>
<view class="uni-container">
<view class="uni-hello-text">
<text class="hello-text">uni原生插件示例1</text>
</view>
<view class="uni-panel" v-for="(item, index) in list" :key="item.id">
<view class="uni-panel-h" :class="item.open ? 'uni-panel-h-on' : ''" @click="triggerCollapse(index)">
<text class="uni-panel-text">{{item.name}}</text>
<text class="uni-panel-icon uni-icon" :class="item.open ? 'uni-panel-icon-on' : ''">{{item.pages ? '&#xe581;' : '&#xe470;'}}</text>
</view>
<view class="uni-panel-c" v-if="item.open">
<view class="uni-navigate-item" v-for="(item2,key) in item.pages" :key="key" @click="goDetailPage(item2.url)">
<text class="uni-navigate-text">{{item2.name ? item2.name : item2}}</text>
<text class="uni-navigate-icon uni-icon">&#xe470;</text>
</view>
</view>
</view>
<view class="uni-panel">
<view class="uni-panel-h" @click="testScanCancle()">testScanCancle</view>
<view class="uni-panel-h" @click="goScan()">goScan</view>
<view class="uni-panel-h" @click="goBallList()">goBallList</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
list: [{
id: 'ext-module',
name: '扩展 module',
open: false,
url: '/pages/sample/ext-module'
},
{
id: 'ext-component',
name: '扩展 component',
open: false,
url: '/pages/sample/ext-component'
},
{
id:'richAlert',
name:'插件示例RichAlert',
open:false,
url:'/pages/sample/richAlert'
}],
navigateFlag: false,
}
},
onLoad() {
},
methods: {
goScan(){
console.log(111);
uni.navigateTo({
url:'./scan'
})
},
goBallList(){
console.log(111);
uni.navigateTo({
url:'./ball_list'
})
},
testScanCancle(){
// 只允许通过相机扫码
uni.scanCode({
onlyFromCamera: true,
success: function (res) {
console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result);
}
});
setTimeout(()=>{
console.log("执行返回");
// uni.navigateBack({
// delta:2
// })
uni.navigateBack()
uni.navigateBack()
},3000)
},
triggerCollapse(e) {
if (!this.list[e].pages) {
this.goDetailPage(this.list[e].url);
return;
}
for (var i = 0; i < this.list.length; ++i) {
if (e === i) {
this.list[i].open = !this.list[e].open;
} else {
this.list[i].open = false;
}
}
},
goDetailPage(e) {
if (this.navigateFlag) {
return;
}
this.navigateFlag = true;
uni.navigateTo({
url: e
});
setTimeout(() => {
this.navigateFlag = false;
}, 200)
return false;
}
}
}
</script>
<style>
#bcid {
background:#0F0;
height:480px;
width:360px;
}
</style>