Closed meloonly closed 1 year ago
{ "name": "vue-amis-project", "version": "0.1.0", "private": true, "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build" }, "dependencies": { "@fortawesome/fontawesome-free": "^6.2.1", "core-js": "^3.6.5", "vue": "^2.6.11", "vue-amis-sdk": "^2.2.0", "vuera": "^0.2.7" }, "devDependencies": { "@vue/cli-plugin-babel": "~4.5.19", "@vue/cli-service": "~4.5.19", "vue-template-compiler": "^2.6.11" } }
import Vue from 'vue' import App from './App.vue'
// fortawesome import "@fortawesome/fontawesome-free/css/all.css"; import "@fortawesome/fontawesome-free/js/all"; import VueAmisSdk from "vue-amis-sdk"; import { VuePlugin } from "vuera";
Vue.use(VueAmisSdk); Vue.use(VuePlugin);
Vue.config.productionTip = false
new Vue({ render: h => h(App), }).$mount('#app')
- App.vue ```vue <template> <div id='app'> <vue-amis-sdk id='editorName' theme='cxd' className='is-fixed' :preview='isPreview' :isMobile='isMobile' @onChange='onChange' :value='schema' /> </div> </template> <script> import "amis-ui/lib/themes/cxd.css"; import "amis-ui/lib/themes/ang.css"; import "amis-editor/dist/style.css"; export default { name: 'App', data() { return { isPreview: false, isMobile: false, schema: {} } }, methods: { onChange(e) { console.log(e) } } } </script>
执行完yarn && yarn serve后,项目可以正常启动,但控制台报了个异常:
yarn && yarn serve
将 amis-sdk-vue 降级到2.1.0的版本
amis-sdk-vue
使用最新版 https://github.com/h7ml/vue-amis-sdk-examples/blob/main/package.json#L14
// fortawesome import "@fortawesome/fontawesome-free/css/all.css"; import "@fortawesome/fontawesome-free/js/all"; import VueAmisSdk from "vue-amis-sdk"; import { VuePlugin } from "vuera";
Vue.use(VueAmisSdk); Vue.use(VuePlugin);
Vue.config.productionTip = false
new Vue({ render: h => h(App), }).$mount('#app')
执行完
yarn && yarn serve
后,项目可以正常启动,但控制台报了个异常: