mydetails.vue 2.13 KB
<template>
     <ul>
        <li>
            <label @click="setAvatar">头像
                <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="nickname" v-model='nickname' @blur="setNickname"></label>
        </li>
        <li>
            <label @click="setAender">性别
                <span class="details-gender">
                    <span class="gender">{{ gender }}</span>
                    <span class="icon icon-right"></span>
                </span>
            </label>
        </li>
        <li>
            <label>生日
                <span class="details-birthday">
                    <input class="birthday" type="date" v-model='birthday' @change="setBirthday"></input>
                    <span class="icon icon-right"></span>
                </span>
            </label>
        </li>
    </ul>
</template>

<script>
    const yoho = require('yoho');
    const $ = require('yoho-jquery');
    const genderSel = require('common/select')(['MEN', 'WOMEN']);

    module.exports = {
        props: ['head_ico', 'nickname', 'gender', 'birthday'],
        data() {
            return {
                icoStyle: this.head_ico ? 'background-image:url(' + this.head_ico + ');' : ''
            };
        },
        methods: {
            setAvatar: function() {
                yoho.goSetAvatar();
            },
            setNickname: function() {
                this.saveDetails();
            },
            setAender: function() {
                let _this = this;

                genderSel.show(function(item) {
                    _this.gender = item.toLowerCase();

                    _this.saveDetails();
                })
            },
            setBirthday: function() {
                this.saveDetails();
            },
            saveDetails: function(params) {
                console.log("saveDetails")
            }
        }
    };
</script>

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