<template>
  <el-checkbox
    v-model="autoPrintSmallTicket"
    style="margin:10px"
    @change="handleSmallTicketPrintChange"
  >
    打印小票
  </el-checkbox>
</template>

<script>
export default {
  props: {
    value: {
      type: Boolean,
      default: false
    }
  },
  data () {
    return {
      autoPrintSmallTicket: this.$localStore.get('autoPrintSmallTicket')
    }
  },
  methods: {
    handleSmallTicketPrintChange (val) {
      this.$localStore.set('autoPrintSmallTicket', val)
      this.$emit('input', val)
    }
  },
  watch: {
    value: {
      handler (val) {
        this.autoPrintSmallTicket = val
      },
      immediate: true
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
