目录

label

Overview

Defines the labels for the input and textarea elements.

Application Scope

Item

Description

Applicable devices

Mobile phones, tablets, Vision products, and telematics devices

Applicable regions

Global

Subelements

None

Attributes

In addition to general attributes, the attribute listed in the following table is supported.

Attribute

Type

Default Value

Mandatory

Description

target

string

-

No

ID of the input element.

Styles

The text style and common styles are supported.

Events

None

Sample Code

<template>
  <div class="container">
    <div class="page-title-wrap">
      <text class="page-title">{{componentName}}</text>
    </div>

    <div class="label-item">
      <label>Label tag:</label>
    </div>

    <div class="label-item">
      <label target="input1">input:</label>
      <input class="flex" id="input1" placeholder="please enter" />
    </div>

    <div class="label-item">
      <label target="textarea1">textarea:</label>
      <textarea class="flex textareaPadding" id="textarea1" placeholder="textarea..."></textarea>
    </div>

    <div class="label-item">
      <label target="radio1">radio:</label>
      <input type="radio" id="radio1" />
    </div>

    <div class="label-item">
      <label target="checkbox1">checkbox:</label>
      <input class="flex" type="checkbox" id="checkbox1" />
    </div>
  </div>
</template>

<style>
    .container {
      flex: 1;
      flex-direction: column;
    }
    .page-title-wrap {
      padding-top: 50px;
      padding-bottom: 80px;
      justify-content: center;
    }
    .page-title {
      padding-top: 30px;
      padding-bottom: 30px;
      padding-left: 40px;
      padding-right: 40px;
      border-color: #bbbbbb;
      color: #bbbbbb;
      border-bottom-width: 2px;
    }
    .label-item {
      align-items: center;
      border-bottom-width: 1px;
      border-color: #dddddd;
    }

    label {
      padding: 30px;
      font-size: 35px;
      width: 250px;
    }

    .flex {
      flex: 1;
    }

    .textareaPadding {
      padding-top: 20px;
    }
</style>

<script>
    export default {
        data: {
            componentName: 'label',
            input_value: ''
        },
        onInit() {
            this.$page.setTitleBar({ text: 'label' })
        }
    }
</script>

The following figure shows the final effect.