🌐 AI搜索 & 代理 主页
Skip to content

Commit d236d92

Browse files
tmorehousejacobmllr95
authored andcommitted
chore(docs): link to options prop details section (closes #4035) (#4036)
* chore(docs): link to options prop details section * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Prettify + correct typos
1 parent fb29d14 commit d236d92

File tree

5 files changed

+66
-31
lines changed

5 files changed

+66
-31
lines changed

CHANGELOG.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111
Released: 2019-09-06
1212

13-
> **BoootstrapVue 2.0.0 stable** introduces several new features and bug fixes. Please note that
14-
> this release also _includes several breaking changes_.
13+
> **BootstrapVue 2.0.0 stable** introduces several new features and bug fixes. Please note that this
14+
> release also _includes several breaking changes_.
1515
1616
**Notable improvements:**
1717

18-
- Tooltips and popovers have been competely re-written for better reactivity and stability. The
18+
- Tooltips and popovers have been completely re-written for better reactivity and stability. The
1919
directive versions are now reactive to trigger element `title` attribute changes and configuration
20-
changes. The component versions now perform better when qucikly hovering/unhovering the trigger
20+
changes. The component versions now perform better when quickly hovering/un-hovering the trigger
2121
element. Component and directive versions now have a default delay of `50`ms (affects `'hover'`
2222
and `'focus'` triggers only). They can now have a trigger of `'manual'` (when used by itself) of
2323
which they can only be opened or closed programmatically. Users can now optionally specify the ID
@@ -30,7 +30,7 @@ Released: 2019-09-06
3030
for targeting inner elements, just like with any other component).
3131
- New SVG background image based sorting indicator icons for `<b-table>`, with the ability to place
3232
them on either the right (default) or left of the table cell headers (via a new prop).
33-
- Programmatic selection of `<b-table>` selctable rows.
33+
- Programmatic selection of `<b-table>` selectable rows.
3434
- Ability to provide your own custom footer structure for `<b-table>` and `<b-table-lite>`.
3535

3636
### Breaking changes and deprecated features removal v2.0.0
@@ -108,8 +108,8 @@ examples, and below for a list of fixes and new features.
108108

109109
### Bug Fixes v2.0.0
110110

111-
- **b-dropdown-\*:** ensure class bindings are placed on root element for all dropdown sub-components
112-
(closes [#4022](https://github.com/bootstrap-vue/bootstrap-vue/issues/4022))
111+
- **b-dropdown-\*:** ensure class bindings are placed on root element for all dropdown
112+
sub-components (closes [#4022](https://github.com/bootstrap-vue/bootstrap-vue/issues/4022))
113113
([#4024](https://github.com/bootstrap-vue/bootstrap-vue/issues/4024))
114114
([81efb89](https://github.com/bootstrap-vue/bootstrap-vue/commit/81efb89))
115115
- **b-form-textarea:** handle initial auto-height when in modal, tabs, or other component with
@@ -137,8 +137,7 @@ examples, and below for a list of fixes and new features.
137137
([#3887](https://github.com/bootstrap-vue/bootstrap-vue/issues/3887))
138138
([2302b31](https://github.com/bootstrap-vue/bootstrap-vue/commit/2302b31))
139139
- **b-table, b-table-lite:** generate `:key` for `row-details` row based on the `primary-key` field
140-
value if available
141-
([#4025](https://github.com/bootstrap-vue/bootstrap-vue/issues/4025))
140+
value if available ([#4025](https://github.com/bootstrap-vue/bootstrap-vue/issues/4025))
142141
([c7cb16f](https://github.com/bootstrap-vue/bootstrap-vue/commit/c7cb16f))
143142
- **v-b-toggle:** don't override `role` if element has a `role` assigned
144143
([#3889](https://github.com/bootstrap-vue/bootstrap-vue/issues/3889))
@@ -232,7 +231,7 @@ examples, and below for a list of fixes and new features.
232231
([#3908](https://github.com/bootstrap-vue/bootstrap-vue/issues/3908))
233232
([eebab43](https://github.com/bootstrap-vue/bootstrap-vue/commit/eebab43))
234233

235-
### Depreaction removals v2.0.0
234+
### Deprecation removals v2.0.0
236235

237236
- **b-dropdown:** remove deprecated slot `text`
238237
([#3868](https://github.com/bootstrap-vue/bootstrap-vue/issues/3868))

src/components/form-checkbox/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ named slot `first`.
8989

9090
## Checkbox group options array
9191

92-
Please see options in [`<b-form-select>`](/docs/components/form-select) docs for details on passing
93-
`options` (value array) to `<b-form-checkbox-group>`.
92+
Please see the [`<b-form-select>` `options` prop](/docs/components/form-select#options-property)
93+
docs for details on the formats and helper props associated with `options`.
9494

9595
## Inline and stacked checkboxes
9696

src/components/form-radio/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ To have them appear _above_ the inputs generated by `options`, place them in the
130130

131131
## Radio group options array
132132

133-
Please see options in [`<b-form-select>`](/docs/components/form-select) docs for details on passing
134-
options (value array) to `<b-form-radio-group>` via the `options` prop.
133+
Please see the [`<b-form-select>` `options` prop](/docs/components/form-select#options-property)
134+
docs for details on the formats and helper props associated with `options`.
135135

136136
## Radio value and v-model
137137

src/components/form-select/README.md

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,7 @@ inline html (i.e. `<i>`, `<strong>`, etc) inside `<option>` elements of a `<sele
128128
user supplied string.
129129
</p>
130130

131-
If you want to customize fields (for example using `name` field for display text) you can easily
132-
change them using `text-field`, `html-field`, `value-field`, and `disabled-field` props.
133-
134-
### Array
131+
### Options as an array
135132

136133
<!-- eslint-disable no-unused-vars -->
137134

@@ -141,10 +138,10 @@ const options = ['A', 'B', 'C', { text: 'D', value: { d: 1 }, disabled: true },
141138

142139
If an array entry is a string, it will be used for both the generated `value` and `text` fields.
143140

144-
You can mix using strings and [objects](#objects) in the array.
141+
You can mix using strings and [objects](#options-as-an-array-of-objects) in the array.
145142

146143
Internally, BootstrapVue will convert the above array to the following array (the
147-
[Array of Objects](#array-of-objects) format:
144+
[array of objects](#options-as-an-array-of-objects)) format:
148145

149146
<!-- eslint-disable no-unused-vars -->
150147

@@ -159,7 +156,7 @@ const options = [
159156
]
160157
```
161158

162-
### Array of objects
159+
### Options as an array of objects
163160

164161
<!-- eslint-disable no-unused-vars -->
165162

@@ -177,7 +174,7 @@ If `value` is missing, then `text` will be used as both the `value` and `text` f
177174
the `html` property, you **must** supply a `value` property.
178175

179176
Internally, BootstrapVue will convert the above array to the following array (the
180-
[Array of Objects](#array-of-objects) format:
177+
[array of objects](#options-as-an-array-of-objects)) format:
181178

182179
<!-- eslint-disable no-unused-vars -->
183180

@@ -187,12 +184,11 @@ const options = [
187184
{ text: 'Item 2', value: 'second', disabled: false },
188185
{ html: '<b>Item</b> 3', value: 'third', disabled: true },
189186
{ text: 'Item 4', value: 'Item 4', disabled: false },
190-
{ text: 'Item 5', value: 'E', disabled: false },
191-
{ text: 'F', value: { foo: 'bar', baz: true }, disabled: false }
187+
{ text: 'Item 5', value: 'E', disabled: false }
192188
]
193189
```
194190

195-
### Object
191+
### Options as an object
196192

197193
Keys are mapped to `value` and values are mapped to option `text`.
198194

@@ -209,7 +205,7 @@ const options = {
209205
```
210206

211207
Internally, BootstrapVue will convert the above object to the following array (the
212-
[Array of Objects](#array-of-objects) format:
208+
[array of objects](#options-as-an-array-of-objects)) format:
213209

214210
<!-- eslint-disable no-unused-vars -->
215211

@@ -219,12 +215,52 @@ const options = [
219215
{ text: 'Item B', value: 'b', disabled: false },
220216
{ html: 'Item C', value: 'c', disabled: false },
221217
{ text: 'Item D', value: 'overridden_value', disabled: true },
222-
{ text: 'E', value: { foo: 'bar', baz: true }, disabled: false }
218+
{ text: 'Item E', value: { foo: 'bar', baz: true }, disabled: false }
223219
]
224220
```
225221

226-
**Note:** When using the [Object](#object) format, the order of the final array is **not**
227-
guaranteed. For this reason, it is recommended to use the above array formats.
222+
**Note:** When using the Object format, the order of the final array is **not** guaranteed. For this
223+
reason, it is recommended to use either of the previously mentioned array formats.
224+
225+
### Changing the option field names
226+
227+
If you want to customize the field property names (for example using `name` field for display
228+
`text`) you can easily change them by setting the `text-field`, `html-field`, `value-field`, and
229+
`disabled-field` props to a string that contains the property name you would like to use:
230+
231+
```html
232+
<template>
233+
<div>
234+
<b-form-select
235+
v-model="selected"
236+
:options="options"
237+
class="mb-3"
238+
value-field="item"
239+
text-field="name"
240+
disabled-field="notEnabled"
241+
></b-form-select>
242+
<div class="mt-3">Selected: <strong>{{ selected }}</strong></div>
243+
</div>
244+
</template>
245+
246+
<script>
247+
export default {
248+
data() {
249+
return {
250+
selected: 'A',
251+
options: [
252+
{ item: 'A', name: 'Option A' },
253+
{ item: 'B', name: 'Option B' },
254+
{ item: 'D', name: 'Option C', notEnabled: true },
255+
{ item: { d: 1 }, name: 'Option D' }
256+
]
257+
}
258+
}
259+
}
260+
</script>
261+
262+
<!-- b-form-select-options-fields.vue -->
263+
```
228264

229265
### Option notes
230266

src/components/form/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,8 @@ export default {
324324
See also:
325325

326326
- [`<b-form-input> datalist`](/docs/components/form-input#datalist-support) for datalist usage.
327-
- [`<b-form-select> options`](/docs/components/form-select#options-property) for more information on
328-
the `options` array format.
327+
- [`<b-form-select>` `options` prop](/docs/components/form-select#options-property) docs for details
328+
on the formats and helper props associated with `options`.
329329

330330
## Validation
331331

0 commit comments

Comments
 (0)