默认情况下
{path: '/post/:postId', component: Post},
Run Code Online (Sandbox Code Playgroud)
正在转换为此
{
path: '/post/:postId',
component: Post
},
Run Code Online (Sandbox Code Playgroud)
如何禁用此行为?
UPD。我用JavaScript编码,上次使用vetur插件在vuejs中编码
UPD2。代码示例。
// before
export default new Router({
routes: [
{ path: '/', component: Home },
{ path: '/about', component: About },
{ path: '/todo', component: Todo },
]
})
// after formatting (curly braces are moved on new line)
export default new Router({
routes: [{
path: '/',
component: Home
},
{
path: '/about',
component: About
},
{
path: '/todo',
component: Todo
},
]
})
Run Code Online (Sandbox Code Playgroud)
UPD 3.也许Prettier对于解决此任务会有用吗? …
要同时水平和垂直居中,有两个简单的选项:
第一
.outer {
display:flex;
}
.inner {
margin:auto;
}
Run Code Online (Sandbox Code Playgroud)
第二
.outer {
display: flex;
justify-content: center;
align-items: center;
}
Run Code Online (Sandbox Code Playgroud)
有什么不同?在什么情况下我们会使用一个而不是另一个?
在项目中,一些常用函数位于单独的 .ts 文件中。在这种情况下我该如何使用 i18:
// for i18n
import Vue from 'vue'
declare module 'vue/types/vue' {
interface VueConstructor {
$t: any
}
}
declare module 'vue/types/options' {
interface ComponentOptions<V extends Vue> {
t?: any
}
}
(()=>{
const test = Vue.$t('auth.title');
console.log( test )
})()
Run Code Online (Sandbox Code Playgroud)
返回错误:
Property '$t' does not exist on type 'VueConstructor<Vue>"
Run Code Online (Sandbox Code Playgroud)
我该如何修复它?
我正在尝试使用 create-react-app 启动 React 项目。npm start
出现错误:
Failed to compile.
multi ./node_modules/react-scripts/config/polyfills.js ./node_modules/react-dev-utils/webpackHotDevClient.js ./src/index.js
Module not found: Can't resolve 'D:\' in 'D:\!!!DESKTOP\React-test\test-react'
Run Code Online (Sandbox Code Playgroud)
我该如何修复它?