VEUI

VEUI on GitHub
Play!中文

Label

Examples

Activation

You can use the for prop to specify the ref of the component to be activated. Clicking on the label area can trigger it.

Inline with Select

for + ref with Input

Edit this demo on GitHubEdit
<template>
<article>
  <section>
    <h4>Inline with Select</h4>
    <veui-label>
      Click me:
      <veui-select
        :options="protocols"
        style="width: 100px"
      />
    </veui-label>
  </section>
  <section>
    <h4><code>for</code> + <code>ref</code> with Input</h4>
    <veui-label for="origin">
      Click me:
    </veui-label>
    <veui-input
      ref="origin"
      style="width: 200px"
    />
  </section>
</article>
</template>

<script>
import { Label, Select, Input } from 'veui'

export default {
  name: 'text-input',
  components: {
    'veui-label': Label,
    'veui-select': Select,
    'veui-input': Input
  },
  data () {
    return {
      protocols: [
        { label: 'https://', value: 'https' },
        { label: 'http://', value: 'http' }
      ]
    }
  }
}
</script>

<style lang="less" scoped>
section {
  margin-bottom: 20px;
}

h4 {
  margin-top: 0;
}
</style>

API

Props

NameTypeDefaultDescription
forstring-

Allows specifying the target component or element through ref, Vue component instance, or HTMLElement. If a component is specified, clicking on the label will call the activate method of the corresponding component (if it exists); if an element is specified, clicking on the label will call the click method of the corresponding element.

TypeDescription
stringLooks up the HTML element or the root element of the corresponding component instance by matching the key name in $refs within the current floating layer component context.
VueIf a component instance is passed in, the root element of the component is returned directly.
HTMLElementIf it is already an HTML element, it is used directly.

Slots

NameDescription
defaultDefault slot. No default content. Used to fill inline content, not allowed to put block-level content.
Edit this page on GitHubEdit
© Baidu, Inc. 2024