You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
855 B
41 lines
855 B
Component({
|
|
options: {
|
|
addGlobalClass: true,
|
|
multipleSlots: true
|
|
},
|
|
properties: {
|
|
content: {
|
|
type: String,
|
|
value: ''
|
|
}
|
|
},
|
|
data: {
|
|
foldble: true,
|
|
unfold: true
|
|
},
|
|
observers: {
|
|
'content': function () {
|
|
this.setContent()
|
|
}
|
|
},
|
|
methods: {
|
|
setContent: function () {
|
|
var query = this.createSelectorQuery()
|
|
var that = this
|
|
query.select('#content').boundingClientRect()
|
|
query.select('#frame').boundingClientRect()
|
|
query.exec(function (res) {
|
|
if (res[0] && res[0].height) {
|
|
if (res[0].height > res[1].height) {
|
|
that.setData({ foldble: true })
|
|
} else {
|
|
that.setData({ foldble: null })
|
|
}
|
|
}
|
|
})
|
|
},
|
|
unfoldText: function(){
|
|
this.setData({ unfold: !this.data.unfold })
|
|
}
|
|
}
|
|
})
|