cshenfu
2024-05-21 09d8c671d5e6e6045677bfb5218a5fb78c26aa0f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<template>
    <view class="page_bg">
        <view style="height: 20rpx;"></view>
        <view class="list_item">
            <u-input v-model="text" type="text" :border="false" />
        </view>
 
        <u-button class="save_btn" shape="circle" :ripple="true" ripple-bg-color="#444" @tap="saveData">确定</u-button>
    </view>
</template>
 
<script>
    var that; // 当前页面对象
    var vk; // vk依赖
    export default {
        data() {
            // 页面数据变量
            return {
                type: '',
                text: ''
            }
        },
        // 监听 - 页面每次【加载时】执行(如:前进)
        onLoad(options = {}) {
            that = this;
            vk = that.vk;
            that.init(options)
        },
        // 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
        onReady() {},
        // 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
        onShow() {},
        // 监听 - 页面每次【隐藏时】执行(如:返回)
        onHide() {},
        // 函数
        methods: {
            // 页面数据初始化函数
            init(options) {
                if (options.text != 'undefined') this.text = options.text
                this.type = options.type
                let title = ''
                switch (options.type) {
                    case 'nickname':
                        title = '昵称';
                        break;
                    case 'profession':
                        title = '职业';
                        break;
                    case 'wxnumber':
                        title = '微信';
                        break;
                    case 'qqnumber':
                        title = 'QQ';
                        break;
                }
                uni.setNavigationBarTitle({ title })
            },
            saveData() {
                uni.$emit('getBack', { type: this.type, text: this.text })
                vk.navigateBack();
            }
        },
    }
</script>
 
<style lang="scss" scoped>
    .page_bg {
        height: 100vh;
        background-color: #F5F5F5;
    }
 
    .list_item {
        height: 112rpx;
        background: #FFFFFF;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 20rpx;
    }
 
    .save_btn {
        background-color: #333333;
        color: #FFFFFF;
        margin: 192rpx 30rpx 0;
    }
</style>