我有一个项目,首先它只是一个普通的SPA,但后来我必须将另一个Vue项目合并到其中,这会导致css冲突......
现在我有一个这样的路由器:
{
path: '/admin',
name: 'Home',
component: MainContainer,
redirect: '/admin/posts/list',
children: .....
},
{
path: '/',
component: Container,
children: .....
}
Run Code Online (Sandbox Code Playgroud)
这意味着我在 1 个 Vue 应用程序中有 2 个系统,但使用不同的 CSS。我的尝试是使用作用域 css 作为主要组件 - 这里是MainContainer
和Container
。但是使用作用域样式使样式不会影响这些子组件。有没有MainContainer
专门供儿童style1.css
使用Container
的style2.css
?如果我删除scoped,样式style1.css
也会影响Container
等等
MainContainer
当页面从=>或反向更改时,我可以检查 vue 路由器并重新加载页面以清理旧的 css Container
,但这似乎不是正确的方法。
我有一个路线实例:
const router = new Router({
routes: [
{
path: '/',
name: 'Home',
component: MainContainer,
redirect: '/news/list',
children: [
{
path: 'advertisement/create',
name: 'Create Advertisement',
title: 'This is title of the page'
component: CreateAdvertisement
}
]
}
]
})
Run Code Online (Sandbox Code Playgroud)
在我的组件中,我尝试控制台 this.$route 但我只得到名称、路径、组件,并且那里没有标题属性。所以我的问题是:通过 Vue 路由器传递自定义属性是否有效?如果有,我的尝试问题出在哪里?
我对Cakephp框架非常陌生,尝试遵循并了解如何使用Cakephp上传文件。我正在使用josediazgonzalez提供的上传插件。在视图文件中,使用formhelper我有:
<?= $this->Form->create($user, ['type' => 'file']) ?>
<fieldset>
<legend><?= __('Add User') ?></legend>
<?php
echo $this->Form->control('name');
echo $this->Form->control('username');
echo $this->Form->control('password');
echo $this->Form->control('role');
echo $this->Form->input('photo', ['type' => 'file']);
echo $this->Form->control('dir');
?>
</fieldset>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>
Run Code Online (Sandbox Code Playgroud)
我想再次打印我在控制器中提交的值,我应该写什么?就像是:
$this->request->data;
Run Code Online (Sandbox Code Playgroud)