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.
65 lines
1.3 KiB
65 lines
1.3 KiB
<template>
|
|
<view class="container">
|
|
<view class="content" style="width: 100%;">
|
|
<home v-if="navIndex === 0" />
|
|
<mine v-else />
|
|
</view>
|
|
<nav-bottom @change="onNavChange" @scan="onScan" class="nav-bottom"></nav-bottom>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import Home from './components/home.vue';
|
|
import Mine from './components/mine.vue';
|
|
|
|
export default {
|
|
components: { Home, Mine },
|
|
data() {
|
|
return {
|
|
navIndex: 0,
|
|
};
|
|
},
|
|
onLoad() {},
|
|
methods: {
|
|
/**
|
|
* 监听nav-bottom的点击事件
|
|
* @param {number} index nav-bottom按钮的索引值
|
|
*/
|
|
onNavChange(index) {
|
|
this.navIndex = index;
|
|
},
|
|
|
|
// 扫一扫
|
|
// 只允许通过相机扫码
|
|
// TODO: 扫码业务
|
|
onScan() {
|
|
uni.scanCode({
|
|
onlyFromCamera: true,
|
|
success: res => {
|
|
console.log('res: ', res);
|
|
console.log('条码类型:' + res.scanType);
|
|
console.log('条码内容:' + res.result);
|
|
},
|
|
});
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.container {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
width: 100%;
|
|
height: 100vh;
|
|
|
|
.content {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
}
|
|
.nav-bottom {
|
|
width: 100%;
|
|
}
|
|
}
|
|
</style>
|
|
|