@@ -46,43 +46,28 @@ var script = {
46
46
watch : {
47
47
text : {
48
48
handler : function ( value ) {
49
- var this$1 = this ;
50
-
51
- var area = document . getElementById ( this . elementId ) ;
52
- if ( ! area ) {
53
- return
54
- }
55
-
56
- this . $nextTick ( function ( ) {
57
- this$1 . countable . count ( area , function ( counter ) {
58
- this$1 . $emit ( 'change' , counter ) ;
59
- } , this$1 . options ) ;
60
- } ) ;
49
+ // Everytime this.text changes we'll update our live count
50
+ this . init ( ) ;
61
51
}
62
52
}
63
53
} ,
64
54
methods : {
65
- // The init function is important because we want to provide counts not
66
- // only during changes, but also on initialization.
67
55
init : function init ( ) {
68
56
var this$1 = this ;
69
57
70
58
// Set our countable instance
71
59
this . countable = countable ;
72
60
73
- var area = document . getElementById ( this . elementId ) ;
74
- if ( ! area ) {
75
- return
76
- }
77
-
78
61
this . $nextTick ( function ( ) {
79
- this$1 . countable . count ( area , function ( counter ) {
62
+ this$1 . countable . count ( this$1 . text , function ( counter ) {
80
63
this$1 . $emit ( 'change' , counter ) ;
81
64
} , this$1 . options ) ;
82
65
} ) ;
83
66
}
84
67
} ,
85
68
mounted : function mounted ( ) {
69
+ // The init function is important because we want to provide counts not
70
+ // only during changes, but also on initialization.
86
71
this . init ( ) ;
87
72
}
88
73
}
@@ -95,23 +80,19 @@ var __vue_render__ = function() {
95
80
var _vm = this ;
96
81
var _h = _vm . $createElement ;
97
82
var _c = _vm . _self . _c || _h ;
98
- return _c (
99
- "div" ,
100
- { staticClass : "countable-div" , attrs : { id : _vm . elementId } } ,
101
- [ _vm . _v ( _vm . _s ( _vm . text ) ) ]
102
- )
83
+ return _c ( "div" )
103
84
} ;
104
85
var __vue_staticRenderFns__ = [ ] ;
105
86
__vue_render__ . _withStripped = true ;
106
87
107
88
/* style */
108
89
var __vue_inject_styles__ = function ( inject ) {
109
90
if ( ! inject ) { return }
110
- inject ( "data-v-7a4afb70_0 " , { source : "\n.countable-div[data-v-7a4afb70] {\n display: none;\n}\n\n /*# sourceMappingURL=vue-countable.vue.map */" , map : { "version" :3 , "sources" :[ "/Users/johndatserakis/Documents/Code/ vue-countable/src/vue-countable .vue" , "vue-countable.vue" ] , "names" :[ ] , "mappings" :";AA0FA;EACA,cAAA;CACA;;ACzFA, 6CAA6C" , "file" :"vue-countable.vue" , "sourcesContent" : [ null , ".countable-div {\n display: none; }\n\n/*# sourceMappingURL=vue-countable.vue.map */" ] } , media : undefined } ) ;
91
+ inject ( "data-v-12d8198d_0 " , { source : "\n/*# sourceMappingURL=vue-countable.vue.map */" , map : { "version" :3 , "sources" :[ "vue-countable.vue" ] , "names" :[ ] , "mappings" :";AACA, 6CAA6C" , "file" :"vue-countable.vue" } , media : undefined } ) ;
111
92
112
93
} ;
113
94
/* scoped */
114
- var __vue_scope_id__ = "data-v-7a4afb70 " ;
95
+ var __vue_scope_id__ = "data-v-12d8198d " ;
115
96
/* module identifier */
116
97
var __vue_module_identifier__ = undefined ;
117
98
/* functional template */
0 commit comments