hasQuestion.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <view class="hasquestion-wrap">
  3. <view class="title">问题描述</view>
  4. <textarea
  5. v-model="text"
  6. placeholder="请输入问题描述"
  7. placeholder-class="textarea-placeholder"
  8. :maxlength="maxlength"
  9. @input="calcWord"
  10. />
  11. <text style="float:right;color:grey;">剩余可输入字数:<text :style="{color:(maxlength-textlength<=10)?'red':'grey'}">{{maxlength-textlength}}</text>字</text>
  12. <view class="btn-wrap">
  13. <view class="btn" @click="handleClick">发布提问</view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. text:'',
  22. textlength:0,
  23. maxlength:100,
  24. };
  25. },
  26. methods: {
  27. handleClick(){
  28. uni.navigateBack({delta:1})
  29. },
  30. //计算字数
  31. calcWord(e){
  32. this.textlength = e.detail.value.length
  33. }
  34. },
  35. };
  36. </script>
  37. <style scoped lang="scss">
  38. .hasquestion-wrap{
  39. padding:40rpx 34rpx;
  40. .title{
  41. margin-bottom: 20rpx;
  42. font-size: 32rpx;
  43. color: #333333;
  44. }
  45. textarea{
  46. width:100%;
  47. height:294rpx;
  48. box-sizing: border-box;
  49. padding:30rpx;
  50. border:1rpx solid #BEBEBE;
  51. border-radius: 8rpx;
  52. }
  53. .btn-wrap{
  54. margin-top: 120rpx;
  55. text-align: center;
  56. .btn{
  57. display: inline-block;
  58. width:390rpx;
  59. height:80rpx;
  60. background-color: #E6B77D;
  61. border-radius: 40rpx;
  62. color: #FFFFFF;
  63. font-size: 32rpx;
  64. text-align: center;
  65. line-height: 80rpx;
  66. }
  67. }
  68. }
  69. </style>