You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 28, 2024. It is now read-only.
It is recommended to install the plugin in your Vue project's entry file. For projects created with [`@vue/cli`](https://cli.vuejs.org/), this is likely your `main.js` file where you are already importing `Vue`.
20
20
21
-
```js
21
+
```js
22
22
// main.js (or your Vue entry file)
23
23
24
24
// Import Vue... you're probably already doing this
@@ -37,11 +37,11 @@ Vue.use(VueCustomTooltip)
37
37
38
38
// 2. Install with custom options (defaults shown)
39
39
Vue.use(VueCustomTooltip, {
40
-
name:'VueCustomTooltip',
41
-
color:'#fff',
42
-
background:'#000',
43
-
borderRadius:12,
44
-
fontWeight:400,
40
+
name:'VueCustomTooltip',
41
+
color:'#fff',
42
+
background:'#000',
43
+
borderRadius:12,
44
+
fontWeight:400,
45
45
})
46
46
```
47
47
@@ -53,7 +53,7 @@ Vue.use(VueCustomTooltip, {
53
53
54
54
For [VuePress](https://vuepress.vuejs.org/) projects, the `theme/enhanceApp.js` is a good location to initialize plugins.
55
55
56
-
```js
56
+
```js
57
57
// theme/enhanceApp.js
58
58
59
59
// Import Vue... you're probably already doing this
// 2. Install with custom options (defaults shown)
83
-
Vue.use(VueCustomTooltip, {
84
-
name:'VueCustomTooltip',
85
-
color:'#fff',
86
-
background:'#000',
87
-
borderRadius:12,
88
-
fontWeight:400,
89
-
})
82
+
// 2. Install with custom options (defaults shown)
83
+
Vue.use(VueCustomTooltip, {
84
+
name:'VueCustomTooltip',
85
+
color:'#fff',
86
+
background:'#000',
87
+
borderRadius:12,
88
+
fontWeight:400,
89
+
})
90
90
}
91
91
```
92
92
93
93
### In-Component Install
94
94
95
95
Alternatively, you may install the component directly within a single file in your project; however, you will not be able to customize the `Vue.use()` options.
96
96
97
-
```html
97
+
```html
98
98
<!-- Single file component -->
99
99
100
100
<script>
101
-
// Import the tooltip component (no options available)
Pass any of the options listed below to `Vue.use(VueCustomTooltip, {...})` to customize the plugin for your project *(not available with [in-component installation](#in-component-install))*.
169
+
Pass any of the options listed below to `Vue.use(VueCustomTooltip, {...})` to customize the plugin for your project _(not available with [in-component installation](#in-component-install))_.
169
170
170
171
> **A note on options tied to CSS properties**
171
172
>
@@ -178,15 +179,15 @@ Pass any of the options listed below to `Vue.use(VueCustomTooltip, {...})` to cu
178
179
179
180
Customize the name of the component you will use in your project. **Camel-case names are preferred**, as this allows for camel-case or kebob-case usage within your project.
180
181
181
-
```js
182
+
```js
182
183
Vue.use(VueCustomTooltip, {
183
-
name:'SuperCoolTooltip', // camel-case preferred
184
+
name:'SuperCoolTooltip', // camel-case preferred
184
185
})
185
186
```
186
187
187
-
If you registered the name using camel-case, you can reference the tooltip component via camel-case *or* kebob-case:
188
+
If you registered the name using camel-case, you can reference the tooltip component via camel-case _or_ kebob-case:
188
189
189
-
```html
190
+
```html
190
191
<!-- Default name (user did not pass the 'name' option) -->
Customize the color of the text displayed in the tooltip.
211
212
212
-
```js
213
+
```js
213
214
Vue.use(VueCustomTooltip, {
214
-
color:'#c1403d', // 3 or 6 digit HEX color, including a leading hash (#)
215
+
color:'#c1403d', // 3 or 6 digit HEX color, including a leading hash (#)
215
216
})
216
217
```
217
218
@@ -222,9 +223,9 @@ Vue.use(VueCustomTooltip, {
222
223
223
224
Customize the background color (and the `underlined` text color) of the tooltip.
224
225
225
-
```js
226
+
```js
226
227
Vue.use(VueCustomTooltip, {
227
-
background:'#1b2735', // 3 or 6 digit HEX color, including a leading hash (#)
228
+
background:'#1b2735', // 3 or 6 digit HEX color, including a leading hash (#)
228
229
})
229
230
```
230
231
@@ -235,9 +236,9 @@ Vue.use(VueCustomTooltip, {
235
236
236
237
Customize the border-radius of the tooltip. Must be an integer.
237
238
238
-
```js
239
+
```js
239
240
Vue.use(VueCustomTooltip, {
240
-
borderRadius:4,
241
+
borderRadius:4,
241
242
})
242
243
```
243
244
@@ -248,9 +249,9 @@ Vue.use(VueCustomTooltip, {
248
249
249
250
Customize the font-weight of the tooltip text. Must be an integer that is a multiple of 100, between 100 - 900.
250
251
251
-
```js
252
+
```js
252
253
Vue.use(VueCustomTooltip, {
253
-
fontWeight:700,
254
+
fontWeight:700,
254
255
})
255
256
```
256
257
@@ -260,13 +261,13 @@ In addition to the [Plugin Options](#options) above, you may also pass props to
260
261
261
262
Props that accept a Boolean value may be passed simply by adding the attribute to the component tag, if a `true` value is desired. See the `sticky` example here:
All other props may be passed as normal attributes (if the corresponding value is a String, like the `label` prop, shown above) or with `v-bind` directives, as shown here:
@@ -303,7 +304,7 @@ The position of the tooltip in relation to the text/element it is surrounding.
303
304
304
305
Swaps out the component's standard `<span>` element with a semantically-correct `<abbr>` element, and sets the [`underlined`](#underlined) prop to `true`. This is useful when adding a tooltip to text within a page's content where you want to provide additional context to a word or phrase, or provide a definition of a word or acronym.
305
306
306
-
```html
307
+
```html
307
308
VuePress pages are served as an <VueCustomTooltiplabel="Single Page Application"abbreviation>SPA</VueCustomTooltip>.
308
309
```
309
310
@@ -340,9 +341,11 @@ The width of the tooltip, if the [`multiline`](#multiline) prop is set to `true`
340
341
341
342
Just like any other Vue component, you can add classes or styles directly to the component tag that will be applied to the rendered `<span>` tag (or `<abbr>` tag, if `abbreviation` is set to `true`).
342
343
343
-
```html
344
+
```html
344
345
<!-- Tooltip component with custom classes and styles -->
This is extremely helpful if you want to extend functionality or tooltip styles within your project, which allows you to tweak things like the display behavior of the tooltip element.
0 commit comments