mydetails.vue 2.06 KB
<template>
     <ul>
        <li>
            <label @click="selicon">头像
                <span class="details-icon">
                    <span class="head-portrait user-avatar" :style='icoStyle'></span>
                    <span class="icon icon-right"></span>
                </span>
            </label>
        </li>
        <li>
            <label>昵称<input class="details-nickname" v-model='nickname'></label>
        </li>
        <li>
            <label @click="selgender">性别<span class="details-gender">{{ gender }}</span></label>
        </li>
        <li>
            <label>生日<input id="birthday" class="details-birthday" type="text" v-model='birthday' readonly></input>
        </li>
    </ul>
</template>

<script>
    const $ = require('yoho-jquery');
    const dtpicker = require('common/anypicker');
    const Select = require('common/select');
    const iconSel = Select(['拍照','从相册选择']);
    const genderSel = Select(['MEN', 'WOMEN']);

    module.exports = {
        props: ['head_ico', 'nickname', 'gender', 'birthday'],
        data() {
            return {
                icoStyle: this.head_ico ? 'background-image:url(' + this.head_ico + ');' : ''
            };
        },
        methods: {
            selicon: function(){
                iconSel.show(function(item) {
                    if (item === '拍照') {
                        console.log('拍照');
                    }

                    if (item === '从相册选择') {
                        console.log('从相册选择');
                    }
                });
            },
            selgender: function(){
                let _this = this;

                genderSel.show(function(item) {
                    _this.gender = item.toLowerCase();
                })
            }
        },
        ready: function(){
            $("#birthday").AnyPicker({
                mode: "datetime",
                dateTimeFormat: "yyyy. MM. dd",
                theme: "iOS"
            });
        }

    };
</script>

<style>
    @import "../../scss/home/_details.css";
</style>