最终需要展示的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>
</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',
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>
<record id="action_dtbEditor" model="ir.actions.client">
<field name="name">dtbEditor</field>
<field name="tag">my_dtbEditor</field>
<field name="target">current</field>
<field name="params">{'params': 'params'}</field>
<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',
作者:白马不是马