"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

exports.__esModule = true;
exports.default = void 0;

require("./Nps.css");

var _component = require("../_utils/component");

var _vueNormalizeComponent = _interopRequireDefault(require("../_utils/vue-normalize-component.js"));

/* script */
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var __vue_script__ = {
  name: (0, _component.createComponentName)('nps'),
  mixins: [_component.componentMixin],
  model: {
    name: 'value',
    event: 'change'
  },
  props: {
    value: {
      type: Number
    },
    maxValue: {
      type: Number,
      default: 10
    }
  },

  data() {
    return {
      hover: false,
      hoverValue: 0
    };
  },

  computed: {
    innerValue() {
      if (this.hover) {
        return this.hoverValue;
      }

      return this.value;
    }

  },
  methods: {
    click(value) {
      this.$emit('change', value);
    }

  }
};
/* template */

var __vue_render__ = function __vue_render__() {
  var _vm = this;

  var _h = _vm.$createElement;

  var _c = _vm._self._c || _h;

  return _c("div", {
    class: _vm.bem()
  }, [_c("div", {
    class: _vm.bem("items")
  }, _vm._l(_vm.maxValue + 1, function (i) {
    return _c("div", {
      key: i,
      class: _vm.bem("item", {
        active: i - 1 === _vm.value
      }),
      on: {
        click: function click($event) {
          _vm.click(i - 1);
        }
      }
    }, [_vm._v("\n            " + _vm._s(i - 1) + "\n        ")]);
  }), 0), _vm._v(" "), _c("div", {
    class: _vm.bem("tips")
  }, [_c("span", [_vm._v("非常不愿意")]), _vm._v(" "), _c("span", [_vm._v("非常愿意")])])]);
};

var __vue_staticRenderFns__ = [];
__vue_render__._withStripped = true;
/* style */

var __vue_inject_styles__ = undefined;
/* scoped */

var __vue_scope_id__ = undefined;
/* module identifier */

var __vue_module_identifier__ = undefined;
/* functional template */

var __vue_is_functional_template__ = false;
/* component normalizer */

/* style inject */

/* style inject SSR */
var _default = (0, _vueNormalizeComponent.default)({
  render: __vue_render__,
  staticRenderFns: __vue_staticRenderFns__
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, undefined, undefined);

exports.default = _default;