组件代码:
<view><input v-model="inputValue" @input="onInput" name="age" placeholder="输入信息" /></view>
</template>
<script>
export default {
name: 'wk-input-test',
behaviors: ['uni://form-field', 'wx://form-field-group'],
emits: ['input'],
data() {
return { inputValue: '' };
},
methods: {
onInput(e) {
this.$emit('input', e.detail.value);
}
}
};
</script>
<style lang="scss"></style>
页面代码:
<template>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<view class="text-area">
<text class="title">{{ title }}</text>
</view>
<form @submit="formSubmit">
<input name="name" placeholder="输入名称" />
<wk-input-test name="age" v-model="age"></wk-input-test>
<button form-type="submit">确定</button>
</form>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello',
age: '',
nickname: ''
};
},
onLoad() {},
methods: {
formSubmit(e) {
console.info(JSON.stringify(e.detail.value));
}
}
};
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>
2 个回复
DCloud_UNI_Anne
问题复现,已转相关人员排查,已加分感谢反馈!
DCloud_UNI_Anne
HBuilderX3.6.7-alpha已修复