12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- Component({
-
- properties: {
- materialData: {
- type: Array,
- value: []
- },
- height: {
- type: String,
- value: ''
- }
- },
-
- data: {
- flag: false,
- animationData: {},
- downUp: '展开',
- src: '../../pages/image/toDown.png'
- },
-
- methods: {
- onTap (e) {
- let flage = e.target.dataset.flag;
- const height = this.properties.materialData.length * 70;
- if(flage){
-
- this.util(flage, '280rpx');
- this.setData({
- 'flag': false,
- 'downUp': '展开',
- 'src': '../../pages/image/toDown.png'
- })
- } else {
- this.util(flage, height + 'rpx');
- this.setData({
- 'flag': true,
- 'downUp': '收起',
- 'src': '../../pages/image/toUp.png'
- })
- }
- },
-
- util (flag, height) {
-
- var animation = wx.createAnimation({
- duration: 200,
- timingFunction: "linear",
- delay: 0
- });
-
- this.animation = animation;
- animation.height(height).step();
- this.setData({
- animationData: animation.export()
- })
- },
-
- preview (e) {
- const warePath = e.currentTarget.dataset.warepath;
- wx.downloadFile({
- url: warePath,
- success: function (res) {
- var filePath = res.tempFilePath
- wx.openDocument({
- filePath: filePath,
- success: function (res) {
- console.log('打开文档成功')
- }
- })
- }
- })
- }
- }
- })
|