<template>
    <div>
        <div class="form-group form-group-center">
            <label for="exampleFormControlSelect1" class="mb-2">請選擇您的產業別</label>
            <select class="form-control mb-3" id="exampleFormControlSelect1" v-model="serviceSelected">
                <option disabled value>產業別</option>
                <option v-for="li in servicelist" :key="li.id" :value="li.name">{{ li.name }}</option>
            </select>
            <button @click.once.prevent="submit_type" class="btn__kw">送出</button>
        </div>
    </div>
</template>

<script>
export default {
    name: 'ServiceSelection',
    props: [
    'userId',
    'logselected'
    ],
    data(){
        return{
            servicelist: [],
            serviceSelected: '',
        }
    },
    methods: {
        getServTypeLi() {
          this.$http.get('http://www.googo.org:8050/api/service_type/').then(res => {
            console.log(res.data);
            this.servicelist = res.data;
          });
        },
        /* submit_type() {
          // console.log(this.serviceSelected);
          const vm = this;
         this.$http.post('http://www.googo.org:8050/api/users_groups/20',
           { service_type: this.serviceSelected }).then(res => {
            this.$router.push('/');
          });
        }, */
    },
    created() {
        this.getServTypeLi();
    }
}
</script>