0.0.19 • Published 6 years ago
b-print-designer v0.0.19
b-print-designer
快速开始
- 安装
cnpm install b-print-designer --save
- 示例代码
<style lang="less">
.demo {
width: auto;
height: auto;
top: 20px;
bottom: 20px;
left: 20px;
right: 20px;
position: absolute;
}
.designer-wrapper {
width: auto;
height: auto;
/* border: 1px solid blue; */
position: absolute;
top: 40px;
bottom: 0px;
left: 0px;
right: 0px;
box-shadow: 0 2px 6px 0 rgba(16, 19, 23, 0.1);
/* text-align: center; */
/* border: 1px solid gray; */
/* background-color: gray; */
}
.designer-wrapper:hover {
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.5);
}
</style>
<template>
<div class="demo">
<div class="designer-wrapper">
<bPrintDesigner
:config="previewerConfig"
urlPrefix=""
:loadFn="load"
:initFn="init"
:requestInterceptor="requestInterceptor"
></bPrintDesigner>
<Modal v-model="isShowTableSetting">helloworld</Modal>
</div>
</div>
</template>
<script>
import PD from 'b-print-designer';
var { defaultConfigGetter, propertyPanelDefaultFactory } = PD;
var customConfig = defaultConfigGetter();
export default {
data(){
return {
isShowTableSetting: false,
};
},
created(){
const that = this;
const propertyPanelFactory = {
getView(kind){
//TODO 可以对指定类型返回自定义的vue组件
return propertyPanelDefaultFactory.getView(kind);
},
getConfig(kind){
if (kind == 'table') {
return {
'onTableAdvanceSettingClick': that.showTableSetting.bind(that),
};
}
}
};
customConfig.toolbar[0].handler = ({
action,
API
})=>{
//do something here before action execute
API.executeAction(action.name).then(()=>{
//do somthieng after action executed.
console.log('save completed');
return null;
}).catch(()=>{
console.error('save error');
});
};
this.config = {
...customConfig,
propertyPanelFactory
};
},
methods: {
load(id){ //designer id
//调用后端接口装载数据
return Promise.resolve('');
},
init(){
return Promise.resolve('');
},
requestInterceptor(config){
//对headers等进行处理
// config.headers.a = 1;
return config;
}
},
components: {
// bPrintDesigner
},
};
</script>
- 其他组件
//属性编辑相关组件
BarcodePropertyPanel,
ImagePropertyPanel,
LinePropertyPanel,
PagePropertyPanel,
TablePropertyPanel,
TextPropertyPanel,
PropertyGroup,
Property,
BarcodePropertyGroup,
BasicPropertyGroup,
ImagePropertyGroup,
LinePropertyGroup,
PagePropertyGroup,
PrintPropertyGroup,
TablePropertyGroup,
TextPropertyGroup,
- 工具
//都在PropertyUtil中
getWatches,
getPropGetters,
getPropDefinesFromTemplate,
formateNumber,
colorNumberToCss,
colorCssToNumber
- methods
reload // 重新加载
contribution
启动测试服务 先把后端服务启动好,再进入前端的demo目录中,执行
npm run install
, 然后执行npm run dev
。如需要修改,可新建自己的分支或者fork自己的库,修改好后进行充分的测试再提交merge request,等待审核通过后合并进master分支。 修改时应该从组件角度进行考虑,进行良好的设计。
0.0.19
6 years ago
0.0.18
6 years ago
0.0.17
6 years ago
0.0.16
6 years ago
0.0.15
6 years ago
1.0.0
6 years ago
0.0.14
6 years ago
0.0.13
6 years ago
0.0.12
6 years ago
0.0.11
6 years ago
0.0.10
6 years ago
0.0.9
6 years ago
0.0.7
6 years ago
0.0.6
6 years ago
0.0.5
6 years ago
0.0.4
6 years ago
0.0.3
6 years ago
0.0.2
6 years ago
0.0.1
6 years ago