DTCloud结合amis编辑器上篇~内嵌版
项目目录
最终需要展示的amis编辑器的html文件
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="format-detection" content="telephone=no"/> <meta name="viewport" content="initial-scale=1,user-scalable=no,width=device-width,viewport-fit=cover"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>amis-editor Demo</title> <link rel="stylesheet" href="https://bce.bdstatic.com/iconfont/iconfont.css"/> <link rel="stylesheet" href="https://unpkg.com/animate.css@4.1.1/animate.min.css"/> <link data-react-helmet="true" rel="shortcut icon" href="https://avatars.githubusercontent.com/u/78204817?s=200&v=4"/> <link href="https://aisuda.github.io/amis-editor-demo/demo/css/vendor.fcbe040c.css" rel="stylesheet"><link href="https://aisuda.github.io/amis-editor-demo/demo/css/index.ed44d890.css" rel="stylesheet"></head> <body> <div id="root"></div> <script defer src="https://aisuda.github.io/amis-editor-demo/demo/scripts/chunk/vendor.41754546.js"></script><script defer src="https://aisuda.github.io/amis-editor-demo/demo/scripts/chunk/index.36c0b146.js"></script></body> </html>
静态文件的模板-xml文件
<?xml version='1.0' encoding='UTF-8'?>
<templates id='template' xml:space='preserve'>
<t t-name="my_dtbEditor">
<iframe src="dtb_editor/static/src/index.html" marginheight="0" marginwidth="0" width="100%" height="100%"></iframe>
</t>
</templates>
静态文件的模板-js文件
dtcloud.define('my_dtbEditor', function (require) {
'use strict';
let core = require('web.core');
let AbstractAction = require('web.AbstractAction');
let my_vueDemo = AbstractAction.extend({
template: 'my_dtbEditor',
// 初始化,可以在action 里传入参数
init: function (parent, action) {
return this._super.apply(this, arguments);
},
start() {
},
})
core.action_registry.add('my_dtbEditor', my_vueDemo);
return my_vueDemo
})
视图xml文件
<?xml version="1.0"?>
<dtcloud>
<data>
<record id="action_dtbEditor" model="ir.actions.client">
<field name="name">dtbEditor</field>
<!-- tag action在客户端的标识符,一般是一个专用的字符串,在js文件中注册该动作时指定。 -->
<field name="tag">my_dtbEditor</field>
<!-- target (可选) current:当前内容区打开action;fullscreen:以全屏模式打开;new:以新窗口打开。 -->
<field name="target">current</field>
<!-- params (可选) 用来传给客户端动作的,字典格式 -->
<field name="params">{'params': 'params'}</field>
<!-- context 作为额外数据,传递给客户端函数。 -->
<field name="context">{'context': 'context'}</field>
</record>
<menuitem
id="menu_dtbEditor"
name="dtbEditor"
action="action_dtbEditor"
groups="base.group_user"
sequence="10"/>
</data>
</dtcloud>
manifest.py
// 只放了主要代码
'data': [
# 视图
'views/home.xml',
],
'assets': {
'web.assets_backend': [
# 页面
'dtb_editor/static/src/index.xml',
# 主要入口
'dtb_editor/static/src/main.js',
],
},
作者:白马不是马
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· 字符编码:从基础到乱码解决
· Open-Sora 2.0 重磅开源!