add file
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
// commpents/textarea-cell/index.js
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
textarea_cell_name: {
|
||||
type: String,
|
||||
value: '示例标题',
|
||||
},
|
||||
required: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
textarea_cell_note: {
|
||||
type: String,
|
||||
value: '示例备注',
|
||||
},
|
||||
textarea_cell_content_placeholder: {
|
||||
type: String,
|
||||
value: '示例placeholder',
|
||||
},
|
||||
t_icon_name: {
|
||||
type: String,
|
||||
value: 'heart',
|
||||
},
|
||||
t_icon_size: {
|
||||
type: String,
|
||||
value: '32rpx',
|
||||
},
|
||||
textarea_val: {
|
||||
type: String,
|
||||
value: '',
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
onshowNote: function(e){
|
||||
console.log(e);
|
||||
var myEventDetail = {} // detail对象,提供给事件监听函数
|
||||
var myEventOption = {} // 触发事件的选项
|
||||
this.triggerEvent('showNote', myEventDetail, myEventOption)
|
||||
},
|
||||
|
||||
bindTextAreaBlur(e){
|
||||
console.log("textarea val: ", e.detail.value);
|
||||
this.triggerEvent('TextAreaBlur', e.detail)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"t-icon": "tdesign-miniprogram/icon/icon"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<view class="textarea-cell">
|
||||
<view class="textarea-cell-top">
|
||||
<view class="textarea-cell-name">{{ textarea_cell_name }}<text wx:if="{{ required }}" class="required"> *</text></view>
|
||||
<view class="textarea-cell-note t-cell__note" bindtap="onshowNote">
|
||||
<view><t-icon name="{{ t_icon_name }}" size="{{ t_icon_size}}" data-name="{{ t_icon_name }}" /></view>
|
||||
<text>{{ textarea_cell_note }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="textarea-cell-content">
|
||||
<textarea bindblur="bindTextAreaBlur" maxlength="1000" style="margin: 32rpx 32rpx 0 32rpx; width: 100%; height: 90%; background-color: #FAFAFA;" name="" id="" placeholder="{{ textarea_cell_content_placeholder }}" value="{{textarea_val}}"></textarea>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,46 @@
|
||||
.required{
|
||||
color: #e34d59;
|
||||
}
|
||||
.t-cell__note{
|
||||
font-size: 25rpx !important;
|
||||
letter-spacing: 2rpx;
|
||||
}
|
||||
.textarea-cell{
|
||||
position: relative;
|
||||
padding: 32rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.textarea-cell-top{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 32rpx;
|
||||
font-weight: 400;
|
||||
}
|
||||
.textarea-cell-note{
|
||||
color: var(--td-cell-note-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.textarea-cell-content{
|
||||
background-color: #FAFAFA;
|
||||
width: 95%;
|
||||
height: 500rpx;
|
||||
display: flex;
|
||||
margin: 30rpx auto 0 auto;
|
||||
}
|
||||
.textarea-cell::after {
|
||||
position: absolute;
|
||||
box-sizing: border-box;
|
||||
content: ' ';
|
||||
pointer-events: none;
|
||||
right: 0;
|
||||
left: 32rpx;
|
||||
bottom: 0;
|
||||
border-bottom: 1px solid var(--td-cell-border-color, var(--td-gray-color-3, #e7e7e7));
|
||||
transform: scaleY(0.5);
|
||||
left: 32rpx;
|
||||
}
|
||||
.textarea-cell-name{
|
||||
font-size: 30rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user