为什么我使用无效呢,从该页面使用HBuilerdX导入插件的,初次使用该插件。没有报错。页面只显示label。
main.js做了引入:
import uniForms from './uni_modules/uni-forms/components/uni-forms/uni-forms.vue'
Vue.component('uni-forms',uniForms)
import uniFormsItem from './uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue'
Vue.component('uni-forms-item',uniFormsItem)
相关代码:
<template>
<view>
<cu-custom bgColor="bg-gradual-blue" :isHome="true">
<block slot="homeText"></block>
<block slot="content">{{title}}</block>
</cu-custom>
<!-- <form>
<view class="cu-form-group margin-top">
<view class="title">姓名</view>
<input placeholder="两字短标题" name="input" requied: true></input>
</view>
<view class="cu-form-group">
<view class="title">输入框</view>
<input placeholder="三字标题" name="input"></input>
</view>
<view class="cu-form-group">
<view class="title">收货地址</view>
<input placeholder="统一标题的宽度" name="input"></input>
</view>
</form> -->
<view class="example">
<!-- 基础表单校验 -->
<uni-forms ref="valiForm" :rules="rules" :modelValue="valiFormData">
<uni-forms-item label="姓名" required name="name">
<uni-easyinput v-model="valiFormData.name" placeholder="请输入姓名" />
</uni-forms-item>
<uni-forms-item label="年龄" required name="age">
<uni-easyinput v-model="valiFormData.age" placeholder="请输入年龄" />
</uni-forms-item>
<uni-forms-item label="自我介绍" name="introduction">
<uni-easyinput type="textarea" v-model="valiFormData.reason" placeholder="请输入自我介绍" />
</uni-forms-item>
</uni-forms>
<button type="primary" @click="submit('valiForm')">提交</button>
</view>
</view>
</template>