调整分包,完成隐私协议(样式待优化)
This commit is contained in:
53
childPackage/miniprogram_npm/towxml/latex/latex.js
Normal file
53
childPackage/miniprogram_npm/towxml/latex/latex.js
Normal file
@@ -0,0 +1,53 @@
|
||||
const config = require('../config');
|
||||
Component({
|
||||
options: {
|
||||
styleIsolation: 'shared'
|
||||
},
|
||||
properties: {
|
||||
data: {
|
||||
type: Object,
|
||||
value: {}
|
||||
}
|
||||
},
|
||||
data: {
|
||||
attr:{
|
||||
src:'',
|
||||
class:''
|
||||
},
|
||||
size:{
|
||||
w:0,
|
||||
h:0
|
||||
}
|
||||
},
|
||||
lifetimes:{
|
||||
attached:function(){
|
||||
const _ts = this;
|
||||
let dataAttr = this.data.data.attrs;
|
||||
|
||||
// 设置公式图片
|
||||
_ts.setData({
|
||||
attrs:{
|
||||
src:`${config.latex.api}=${dataAttr.value}&theme=${global._theme}`,
|
||||
class:`${dataAttr.class} ${dataAttr.class}--${dataAttr.type}`
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
load:function(e){
|
||||
const _ts = this;
|
||||
|
||||
// 公式图片加载完成则根据其图片大小、类型计算其显示的合适大小
|
||||
let scale = 20,
|
||||
w = e.detail.width / scale,
|
||||
h = e.detail.height /scale;
|
||||
|
||||
_ts.setData({
|
||||
size:{
|
||||
w:w,
|
||||
h:h
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
5
childPackage/miniprogram_npm/towxml/latex/latex.json
Normal file
5
childPackage/miniprogram_npm/towxml/latex/latex.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
}
|
||||
}
|
1
childPackage/miniprogram_npm/towxml/latex/latex.wxml
Normal file
1
childPackage/miniprogram_npm/towxml/latex/latex.wxml
Normal file
@@ -0,0 +1 @@
|
||||
<image class="{{attrs.class}}" lazy-load="true" src="{{attrs.src}}" style="width:{{size.w}}em; height:{{size.h}}em;" bindload="load"></image>
|
Reference in New Issue
Block a user