hello.vue 770 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <template>
  2. <view class="hello" >
  3. <input type="text" v-model="text" class="edittext"/>
  4. <button @click="sendName" type="primary" style="margin-top: 20rpx">发送名称</button>
  5. </view>
  6. </template>
  7. <script>
  8. export default {
  9. props: {},
  10. data: () => ({
  11. text:''
  12. }),
  13. computed: {},
  14. methods: {
  15. sendName(){
  16. uni.$emit('updateName',this.text)
  17. }
  18. },
  19. watch: {},
  20. // 组件周期函数--监听组件挂载完毕
  21. mounted() {},
  22. // 组件周期函数--监听组件激活(显示)
  23. activated() {},
  24. // 组件周期函数--监听组件停用(隐藏)
  25. deactivated() {},
  26. // 组件周期函数--监听组件销毁之前
  27. beforeDestroy() {},
  28. };
  29. </script>
  30. <style>
  31. .edittext {
  32. display: flex;
  33. border: 1rpx solid #333333;
  34. }
  35. </style>