-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCustomComponent.vue
135 lines (121 loc) · 2.78 KB
/
CustomComponent.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<template>
<v-col
id="components-v-inline-custom-field"
class="mb-5"
cols="12"
>
<h2
class="mb-0"
:class="classes.h2"
>
<a
:class="classes.headerA"
href="#components-v-inline-custom-field"
>#</a>
VInlineCustomField
</h2>
With the <code class="ic">VInlineCustomField</code> component, you can add your own fields by using the <code
class="ic"
>default</code> slot. This slot has all of the settings and the <code class="ic">originalValue</code> bound to it.
</v-col>
<v-col cols="12">
<v-card>
<v-card-title>Component using the <code class="ic">v-slider</code> field</v-card-title>
<v-card-text>
<v-row>
<v-col
class="d-flex align-top"
cols="2"
>
<VInlineCustomField
v-model="range"
:loading="loading"
:loading-wait="false"
>
<template #default="">
<v-slider
v-model="range"
show-ticks
step="10"
></v-slider>
</template>
</VInlineCustomField>
</v-col>
<v-col cols="2">
<div>
<v-slider
v-model="range"
show-ticks
step="10"
></v-slider>
</div>
</v-col>
</v-row>
</v-card-text>
</v-card>
</v-col>
<v-col
id="inline-custom-field-props"
cols="12"
>
<h3 :class="classes.h3">
<a
:class="classes.headerA"
href="#inline-custom-field-props"
>#</a>
Props
</h3>
</v-col>
<v-col cols="12">
Most of the <a href="#props-shared">shared props</a> can be used with this component. The <a
href="#props-save-and-loading-icon"
>Save & Loading Icon</a> as well as the <a href="#props-prepend-append-icons">Prepend & Append Icon</a> Props
props will most likely be the most useful if you need them.
</v-col>
<v-col cols="12">
<CodeBlock
class="mb-6"
:code="exampleCode"
:highlightjs="codeBlockSettings.plugin === 'highlightjs'"
label="Basic Example"
lang="html"
:prismjs="codeBlockSettings.plugin === 'prismjs'"
:theme="codeBlockSettings.theme"
></CodeBlock>
</v-col>
</template>
<script setup>
import { computed, inject, ref } from 'vue';
const props = defineProps({
codeBlockOptions: {
required: true,
type: Object,
},
});
const codeBlockSettings = computed(() => props.codeBlockOptions);
const classes = inject('classes');
const loading = ref(false);
const range = ref(50);
const exampleCode = `<template>
<VInlineCustomField
v-model="range"
:loading="loading"
>
<template #default="settings">
<v-slider
v-model="range"
show-ticks
step="10"
>
</v-slider>
<\/template>
<\/VInlineCustomField>
<\/template>
<script setup>
import { ref } from 'vue';
const range = ref(50);
const loading = ref(false);
<\/script>`;
</script>
<style lang="scss" scoped>
</style>