小编Sar*_*mad的帖子

在vue中从api加载路由

我正在尝试从我的 API 加载 Vue 应用程序中的路由。我尝试将数据推送到路由变量并使用 addRoutes 方法。但没有运气。我认为异步可能存在问题。但是为什么 addRoutes() 不起作用?

这是我的代码:

import Vue from 'vue';
import VueRouter from 'vue-router';
import axios from 'axios';

/**
 * Routes
*/
import item_index from '../../app/Tenant/Item/Views/Index.vue';
import contact_index from '../../app/Tenant/Contact/Views/Index.vue';
import eav_index from '../../app/Tenant/Eav/Views/create.vue';
import eav_create from '../../app/Tenant/Eav/Views/create.vue';

var routes = [
     { path: '/items', component: item_index, name: 'item_index' },
     { path: '/contact', component: eav_index , name: 'contact_index' , props: { entity_type_id: 1 }},
 ];


Vue.use(VueRouter);

const router = new VueRouter({
    mode: 'history',
    linkActiveClass: 'active',
    routes …
Run Code Online (Sandbox Code Playgroud)

vue.js vue-router vue-component axios

3
推荐指数
1
解决办法
6839
查看次数

Vue 3 Composition API 提供/注入在单个文件组件中不起作用

我正在使用 Composition API 在 VueJS 3 中创建一个库。我实现了docs 中提到的提供/注入。但是子组件中的属性仍未定义,并且在浏览器控制台中出现以下错误:

控制台输出

我的代码的一个非常简单的实现如下:

在项目中使用

<ThemeProvider>
    <Button color="green">
        ABC
    </Button>
</ThemeProvider>

<script>
    import { ThemeProvider, Button } from 'my-library'

    export default {
        name: 'SomePage',
        setup() {...},
    }
</script>
Run Code Online (Sandbox Code Playgroud)

ThemeProvider.js(父组件)

import { toRefs, reactive, provide, h } from 'vue'

export default {
    name: 'theme-provider',
    props:
        theme: {
            type: Object,
            default: () => ({...}),
        },
    },
    setup(props, { slots }) {
        const { theme } = toRefs(props)

        provide('theme', reactive(theme.value))

        return () =>
            h(
                'div',
                {...}, …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vue-component vuejs3 vue-composition-api

2
推荐指数
2
解决办法
5603
查看次数

如何创建动态(支持自定义字段)的SaaS应用程序?

我想用Laravel 5.4在PHP中构建一个多租户SaaS应用程序。我已经为架构所需的几乎每个模块做好了准备,但是现在自动定制字段生成给我留下了深刻的印象

就像我们在SAP,Oracle eBiz Suit,Sage CRM,Salesforce等中自定义表格一样。我想创建一个这样的架构。因此,如果任何用户/公司都需要自定义字段或字段集,则无需重新编写代码。字段应像拖放功能一样添加。

我不知道这项技术是否有特定术语。但是我需要一些有关此模块体系结构的指导和教程。

谢谢你的帮助!

php architecture erp crm laravel

1
推荐指数
1
解决办法
353
查看次数