<template> <view style="padding: 1rem;background: #fff;width:100%;height: 100vh;" class="flex flex_column"> <view style="flex:1;"><u-input style="border-radius: 50rpx;" height="90" :maxlength="30" v-model="shelfName" border placeholder="请输入货架名称(最多30个字符)"></u-input></view> <view><u-button @click="save" shape="circle" type="primary">保存</u-button></view> </view> </template> <script> export default { data() { return { shelfName: '' } }, onLoad(opts) { this.shelfName = opts.shelfName }, methods: { save(){ if(this.shelfName&&this.shelfName.replace(/\s+/g,'') != ''){ uni.$emit('editShelfName',{shelfName: this.shelfName}) uni.navigateBack() }else{ uni.showToast({ icon:"none", title: "请输入货架名称" }) } } } } </script> <style> </style>