ruleName.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <view class="container">
  3. <!-- 规则名称输入区域 -->
  4. <view class="input">
  5. <uni-easyinput :inputBorder="false" focus v-model="name" placeholder="请输入规则名称"></uni-easyinput>
  6. </view>
  7. <!-- 确认按钮区域 -->
  8. <view class="button" @click="handleConfirm">
  9. 确认
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. data() {
  16. return {
  17. name: "",
  18. type: ""
  19. };
  20. },
  21. onLoad(options) {
  22. this.type = options.type
  23. },
  24. methods: {
  25. // 点击确认按钮回调
  26. handleConfirm() {
  27. if (!this.name) {
  28. uni.showToast({
  29. title: "请输入规则名称",
  30. icon: 'none'
  31. })
  32. } else {
  33. if (this.type == 1) {
  34. uni.$emit('updateRuleName', this.name)
  35. } else {
  36. uni.setStorageSync("ruleName", this.name)
  37. }
  38. uni.navigateBack({
  39. delta: 1
  40. })
  41. }
  42. }
  43. }
  44. }
  45. </script>
  46. <style lang="scss" scoped>
  47. .container {
  48. padding-top: 22rpx;
  49. .input {
  50. display: flex;
  51. align-items: center;
  52. margin: 0 auto;
  53. width: 690rpx;
  54. height: 87rpx;
  55. background-color: #fff;
  56. }
  57. .button {
  58. margin: 0 auto;
  59. margin-top: 118rpx;
  60. width: 690rpx;
  61. height: 80rpx;
  62. line-height: 80rpx;
  63. text-align: center;
  64. color: #fff;
  65. font-size: 32rpx;
  66. font-weight: 500;
  67. border-radius: 16rpx;
  68. background-color: #3396FB;
  69. }
  70. }
  71. </style>