详细问题描述
uniapp代码打包成小程序,表单获取不到组件内的表单元素数据
# 父组件
<template>
<view>
<form @submit="formSubmit">
<view>
<text>正常的input</text>
<input
class="uni-input"
type="text"
name="name1"
placeholder="正常的input"
/>
</view>
<input-module :item="{name: 'adc'}"></input-module>
<button type="primary" form-type="submit" class="submit-btn-ssty">提交</button>
<!-- class="submit-btn" -->
</form>
</view>
</template>
<script>
import inputModule from './components/inputModules.vue'
export default {
data() {
return {
};
},
components: { inputModule},
onLoad(obj) {
},
methods: {
// 表单数据提交
formSubmit(e) {
console.log(e)
},
},
}
</script>
<style lang="scss">
page {
background-color: $page-background-color;
}
</style>
# zi组件
<template>
<view>
<!-- disabledValue -->
<text>组件内的input</text>
<input
class="uni-input"
type="text"
:name="item.name"
placeholder="组件内的input"
/>
</view>
</template>
<script>
export default {
props: ['item'],
data() {
return {
inputModule: false,
};
},
created() {
},
methods: {
},
}
</script>
<style lang="scss" scoped>
</style>
联系方式
[862064348]