Skip to content

Commit bbabc45

Browse files
committed
refactor: update slots syntax to be compatibile with vue.js version 3
1 parent 8d5080a commit bbabc45

File tree

9 files changed

+94
-82
lines changed

9 files changed

+94
-82
lines changed

src/components/Form/CFormCheckbox.vue

+16-12
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
11
<template>
22
<CFormGroup v-bind="{validFeedback, invalidFeedback, tooltipFeedback,
33
description, class: computedClasses}">
4-
<input slot="input"
5-
v-bind="$attrs"
6-
:id="safeId"
7-
:type="type"
8-
:class="inputClasses"
9-
:value="value"
10-
:checked="state"
11-
@change="onChange($event)"
12-
/>
4+
<template #input>
5+
<input
6+
v-bind="$attrs"
7+
:id="safeId"
8+
:type="type"
9+
:class="inputClasses"
10+
:value="value"
11+
:checked="state"
12+
@change="onChange($event)"
13+
/>
14+
</template>
1315

1416

15-
<template slot="labelAfterInput">
17+
<template #labelAfterInput>
1618
<slot name="labelAfterInput">
17-
<label v-if="label" :for="safeId" :class="labelClasses">{{label}}</label>
19+
<label v-if="label" :for="safeId" :class="labelClasses">
20+
{{label}}
21+
</label>
1822
</slot>
1923
</template>
2024

2125

2226
<template v-for="slot in ['label', 'prepend', 'append', 'validFeedback', 'invalidFeedback','description']"
23-
:slot="slot"
27+
#[slot]
2428
>
2529
<slot :name="slot">
2630
</slot>

src/components/Form/CFormFile.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
tooltipFeedback, description,
44
wrapperClasses, class: computedClasses}"
55
>
6-
<template slot="label">
6+
<template #label>
77
<slot name="label">
88
<label v-if="label" :for="safeId" :class="labelClasses">{{label}}</label>
99
</slot>
1010
</template>
1111

1212

13-
<template slot="input">
13+
<template #input>
1414
<input v-bind="$attrs"
1515
:id="safeId"
1616
:class="inputClasses"
@@ -26,7 +26,7 @@
2626

2727
<template v-for="slot in ['labelAfterInput','validFeedback',
2828
'invalidFeedback','description']"
29-
:slot="slot"
29+
#[slot]
3030
>
3131
<slot :name="slot"></slot>
3232
</template>

src/components/Form/CFormInput.vue

+15-12
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,28 @@
33
invalidFeedback, tooltipFeedback, description,
44
wrapperClasses, class: computedClasses}"
55
>
6-
<template slot="label">
6+
<template #label>
77
<slot name="label">
88
<label v-if="label" :for="safeId" :class="labelClasses" v-html="label"></label>
99
</slot>
1010
</template>
11-
<input slot="input"
12-
v-bind="$attrs"
13-
:id="safeId"
14-
:type="type"
15-
:class="inputClasses"
16-
:readonly="readonly || plaintext"
17-
:value="state"
18-
@input="onInput($event)"
19-
@change="onChange($event)"
20-
/>
11+
<template #input>
12+
<input
13+
v-bind="$attrs"
14+
:id="safeId"
15+
:type="type"
16+
:class="inputClasses"
17+
:readonly="readonly || plaintext"
18+
:value="state"
19+
@input="onInput($event)"
20+
@change="onChange($event)"
21+
/>
22+
</template>
23+
2124

2225
<template v-for="slot in ['prepend', 'append', 'labelAfterInput',
2326
'validFeedback', 'invalidFeedback','description']"
24-
:slot="slot"
27+
#[slot]
2528
>
2629
<slot :name="slot">
2730
</slot>

src/components/Form/CFormSelect.vue

+30-29
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,44 @@
33
invalidFeedback, tooltipFeedback, description,
44
wrapperClasses, class: computedClasses}"
55
>
6-
<template slot="label">
6+
<template #label>
77
<slot name="label">
88
<label v-if="label" :for="safeId" :class="labelClasses">{{label}}</label>
99
</slot>
1010
</template>
1111

12-
13-
<select slot="input"
14-
v-bind="$attrs"
15-
:id="safeId"
16-
:class="inputClasses"
17-
:value="String(state)"
18-
@input="onSelect($event)"
19-
>
20-
<option v-if="placeholder" value="" selected disabled hidden>{{placeholder}}</option>
21-
<template v-for="(option, key) in options">
22-
<option v-if="typeof option === 'object'"
23-
:value="String(option.value)"
24-
:disabled="option.disabled"
25-
:data-key="key"
26-
:key="key"
27-
>
28-
{{option.text || option.value}}
29-
</option>
30-
<option v-else
31-
:value="String(option)"
32-
:data-key="key"
33-
:key="key"
34-
>
35-
{{option}}
36-
</option>
37-
</template>
38-
</select>
12+
<template #input>
13+
<select
14+
v-bind="$attrs"
15+
:id="safeId"
16+
:class="inputClasses"
17+
:value="String(state)"
18+
@input="onSelect($event)"
19+
>
20+
<option v-if="placeholder" value="" selected disabled hidden>{{placeholder}}</option>
21+
<template v-for="(option, key) in options">
22+
<option v-if="typeof option === 'object'"
23+
:value="String(option.value)"
24+
:disabled="option.disabled"
25+
:data-key="key"
26+
:key="key"
27+
>
28+
{{option.text || option.value}}
29+
</option>
30+
<option v-else
31+
:value="String(option)"
32+
:data-key="key"
33+
:key="key"
34+
>
35+
{{option}}
36+
</option>
37+
</template>
38+
</select>
39+
</template>
3940

4041

4142
<template v-for="slot in ['prepend', 'append', 'labelAfterInput', 'validFeedback', 'invalidFeedback', 'description']"
42-
:slot="slot"
43+
#[slot]
4344
>
4445
<slot :name="slot">
4546
</slot>

src/components/Form/CFormTextarea.vue

+13-11
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,25 @@
33
invalidFeedback, tooltipFeedback, description,
44
wrapperClasses, class: computedClasses}"
55
>
6-
<template slot="label">
6+
<template #label>
77
<slot name="label">
88
<label v-if="label" :for="safeId" :class="labelClasses">{{label}}</label>
99
</slot>
1010
</template>
11-
<textarea slot="input"
12-
v-bind="$attrs"
13-
:id="safeId"
14-
:class="inputClasses"
15-
:readonly="readonly || plaintext"
16-
:value="state"
17-
@input="onInput($event)"
18-
@change="onChange($event)"
19-
/>
11+
<template #input>
12+
<textarea
13+
v-bind="$attrs"
14+
:id="safeId"
15+
:class="inputClasses"
16+
:readonly="readonly || plaintext"
17+
:value="state"
18+
@input="onInput($event)"
19+
@change="onChange($event)"
20+
/>
21+
</template>
2022

2123
<template v-for="slot in ['prepend', 'append', 'labelAfterInput', 'validFeedback', 'invalidFeedback','description']"
22-
:slot="slot"
24+
#[slot]
2325
>
2426
<slot :name="slot">
2527
</slot>

src/components/Header/HeaderDropdown.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<b-nav-item-dropdown :right="right" :no-caret="noCaret">
3-
<template slot="button-content">
3+
<template #buttonContent>
44
<slot name="header">
55
&#10068;
66
</slot>

src/components/Sidebar/SidebarNav.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export default {
9595
}
9696
},
9797
mounted () {
98-
console.error(this.$options._componentTag + ' component is deprecated and will be replaced in coreui-vue 3.0 version, please import C - prefixed version')
98+
console.error(this.$options._componentTag + ' component is deprecated and will be removed in 3.0 version')
9999
}
100100
}
101101
</script>

src/components/Widgets/docs/CWidget04.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ You can also customize icon by utilizing slot named "icon"
3333
rightFooter="time"
3434
leftHeader="17"
3535
leftFooter="percentage">
36-
<i slot="icon"
37-
class="fa fa-battery-1"
38-
></i>
36+
<template #icon>
37+
<i class="fa fa-battery-1"></i>
38+
</template>
3939
</CWidget04>
4040
```

src/components/Widgets/docs/CWidget06.md

+12-10
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@ text | `'text:string'`
1212
<CWidget06 variant="info"
1313
header="9.823"
1414
text="Members online">
15-
<b-dropdown slot="dropdown"
16-
class="float-right"
17-
variant="transparent p-0"
18-
right>
19-
<i slot="button-content"
20-
class="icon-settings"
21-
></i>
22-
<b-dropdown-item>Action</b-dropdown-item>
23-
</b-dropdown>
15+
<template #dropdown>
16+
<CDropdown
17+
class="float-right"
18+
variant="transparent p-0"
19+
right
20+
>
21+
<template #buttonContent>
22+
<i class="icon-settings"></i>
23+
</template>
24+
<CDropdownItem>Action</CDropdownItem>
25+
</CDropdown>
26+
</template>
2427
<CSimpleBarChart label="Members"/>
25-
2628
</CWidget06>
2729
```

0 commit comments

Comments
 (0)