1 | var script = {
|
2 | name: 'VRating',
|
3 |
|
4 | props: {
|
5 | value: {
|
6 | type: Number,
|
7 | default: 0,
|
8 | required: true
|
9 | },
|
10 | type: {
|
11 | type: String,
|
12 | default: 'star',
|
13 | required: false
|
14 | },
|
15 | clearable: {
|
16 | type: Boolean,
|
17 | default: true,
|
18 | required: false
|
19 | },
|
20 | max: {
|
21 | type: Number,
|
22 | default: 5,
|
23 | required: false
|
24 | },
|
25 | initial: {
|
26 | type: Number,
|
27 | default: 0,
|
28 | required: false
|
29 | }
|
30 | },
|
31 |
|
32 | data: function data() {
|
33 | return {
|
34 | el: []
|
35 | };
|
36 | },
|
37 |
|
38 | watch: {
|
39 | value: function value(val, oldVal) {
|
40 | if (val === null) {
|
41 | $(this.el[0]).rating('clear rating');
|
42 | }
|
43 | }
|
44 | },
|
45 |
|
46 | mounted: function mounted() {
|
47 | var t = this;
|
48 | t.el = document.getElementsByClassName('ui rating');
|
49 | $(t.el[0]).rating({
|
50 | initialRating: t.initial,
|
51 | maxRating: t.max,
|
52 | clearable: t.clearable,
|
53 | onRate: function onRate(rating) {
|
54 | t.$emit('input', rating);
|
55 | }
|
56 | });
|
57 | }
|
58 | };
|
59 |
|
60 | function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
|
61 | if (typeof shadowMode !== 'boolean') {
|
62 | createInjectorSSR = createInjector;
|
63 | createInjector = shadowMode;
|
64 | shadowMode = false;
|
65 | }
|
66 |
|
67 | var options = typeof script === 'function' ? script.options : script;
|
68 |
|
69 | if (template && template.render) {
|
70 | options.render = template.render;
|
71 | options.staticRenderFns = template.staticRenderFns;
|
72 | options._compiled = true;
|
73 |
|
74 | if (isFunctionalTemplate) {
|
75 | options.functional = true;
|
76 | }
|
77 | }
|
78 |
|
79 | if (scopeId) {
|
80 | options._scopeId = scopeId;
|
81 | }
|
82 |
|
83 | var hook;
|
84 |
|
85 | if (moduleIdentifier) {
|
86 | hook = function hook(context) {
|
87 | context = context || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
|
88 |
|
89 | if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
90 | context = __VUE_SSR_CONTEXT__;
|
91 | }
|
92 |
|
93 | if (style) {
|
94 | style.call(this, createInjectorSSR(context));
|
95 | }
|
96 |
|
97 | if (context && context._registeredComponents) {
|
98 | context._registeredComponents.add(moduleIdentifier);
|
99 | }
|
100 | };
|
101 |
|
102 | options._ssrRegister = hook;
|
103 | } else if (style) {
|
104 | hook = shadowMode ? function () {
|
105 | style.call(this, createInjectorShadow(this.$root.$options.shadowRoot));
|
106 | } : function (context) {
|
107 | style.call(this, createInjector(context));
|
108 | };
|
109 | }
|
110 |
|
111 | if (hook) {
|
112 | if (options.functional) {
|
113 | var originalRender = options.render;
|
114 |
|
115 | options.render = function renderWithStyleInjection(h, context) {
|
116 | hook.call(context);
|
117 | return originalRender(h, context);
|
118 | };
|
119 | } else {
|
120 | var existing = options.beforeCreate;
|
121 | options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
122 | }
|
123 | }
|
124 |
|
125 | return script;
|
126 | }
|
127 |
|
128 | var normalizeComponent_1 = normalizeComponent;
|
129 |
|
130 | var __vue_script__ = script;
|
131 |
|
132 | var __vue_render__ = function __vue_render__() {
|
133 | var _vm = this;
|
134 | var _h = _vm.$createElement;
|
135 | var _c = _vm._self._c || _h;
|
136 | return _c("div", { staticClass: "ui rating", class: [_vm.type] });
|
137 | };
|
138 | var __vue_staticRenderFns__ = [];
|
139 | __vue_render__._withStripped = true;
|
140 |
|
141 | var __vue_inject_styles__ = undefined;
|
142 |
|
143 | var __vue_scope_id__ = undefined;
|
144 |
|
145 | var __vue_module_identifier__ = undefined;
|
146 |
|
147 | var __vue_is_functional_template__ = false;
|
148 |
|
149 |
|
150 | var VRating = normalizeComponent_1({ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, undefined, undefined);
|
151 |
|
152 | export default VRating;
|