我喜欢使用 tailwind css 将图像定位在另一个图像上,我想知道如何主要使用 tailwind 实用程序类来完成此操作。
现在我正在使用:
style="top: 200px; left: 260px;"
Run Code Online (Sandbox Code Playgroud)
虽然它有效,但我喜欢使用顺风类,例如
class="top-200 left-260"
Run Code Online (Sandbox Code Playgroud)
我尝试了几个顺风课程,但我无法让它发挥作用。
<div class="relative">
<div>
<img
class="absolute mt-5 ml-0"
src="@/assets/floor_image.jpg"
width="600"
/>
</div>
<div>
<img
src="@/assets/blue_golf.png"
style="top: 200px; left: 260px;"
class="cursor-pointer absolute"
/>
</div>
</div>
Run Code Online (Sandbox Code Playgroud) 我正在寻找一种禁用console.log()生产环境的方法。类似于将以下代码放入nuxt.config.js或index.js:
if (process.env.NODE_ENV !== "development") {
console.log = () => {};
}
Run Code Online (Sandbox Code Playgroud)
我试过了,但它不起作用。任何帮助,将不胜感激。
我的 nuxt.config.js 在这里 https://gist.github.com/somaria/9a2b0e06497d13a35fe9eee141a15d07
如果字符串超过 50 个字符,是否可以使用三元运算符添加 '...'?
我像这样尝试过,但它不起作用。
{post.title.substring(0, 50) + post.title.length > 50
? '...'
: ''}
Run Code Online (Sandbox Code Playgroud)
有什么建议吗?
我正在尝试使用算法 ES256 生成 accessToken,并且使用以下非常非常简单的代码:
const jwt = require('jsonwebtoken')
const accessToken = jwt.sign(
{ name: 'John' },
'testsecret',
{ expiresIn: '24h' },
{ algorithm: 'ES256' }
)
console.log(accessToken)
Run Code Online (Sandbox Code Playgroud)
我得到了一个令牌,如下所示:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSm9obiIsImlhdCI6MTYxNDY4MzUxNCwiZXhwIjoxNjE0NzY5OTE0fQ.Q9quAufyTQvPvKrTUXzRDUo-o0M4yXSXjqU4vZ9nvvA
我尝试将其粘贴到 jwt.io ,它似乎是 HS256 令牌而不是 ES256,我错过了什么吗?
有件事我没有做对。你可以随时将上面的代码粘贴到nodejs中,你就会看到。
我曾经有以下代码,但升级到 iOS 13 后,出现以下错误:
UIApplication.shared.statusBarView?.backgroundColor = UIColor(red: 94/225, green: 64/255, blue:204/255, alpha: 1.0)
Run Code Online (Sandbox Code Playgroud)
在 UIApplication 上调用 -statusBar 或 -statusBarWindow 的应用程序:必须更改此代码,因为不再有状态栏或状态栏窗口。改为在窗口场景中使用 statusBarManager 对象。
现在怎么设置状态栏的背景色?
警告消息提到了使用 statusBarManager,所以我做了这样的事情,但我无法让它工作。
var statusBar = UIView()
if #available(iOS 13.0, *) {
statusBar = UIView(frame: UIApplication.shared.keyWindow?.windowScene?.statusBarManager?.statusBarFrame ?? CGRect.zero)
statusBar.backgroundColor = UIColor.red
UIApplication.shared.keyWindow?.addSubview(statusBar)
} else {
//ios 12 and below
UIApplication.shared.statusBarView?.backgroundColor = UIColor(red: 94/225, green: 64/255, blue:204/255, alpha: 1.0)
}
Run Code Online (Sandbox Code Playgroud) 我有一个 item.channelId ,我想在 href 中使用它。它应该实现这样的目标:
<a :href="https://youtube.com/${item.channelId}">{{
item.channelTitle
}}</a>
Run Code Online (Sandbox Code Playgroud)
如何将 item.channelId 放入 href 中?
我对 Next.js 非常陌生,无法使其getStaticProps正常工作。
import firebase from '../firebase'
export default function Home({ posts }) {
return (
<div>
<h1>All Posts</h1>
{posts.map((post) => (
<div key={post.pid}>{post.title}</div>
))}
</div>
)
}
export const getStaticProps = async () => {
let posts = []
firebase
.firestore()
.collection('posts')
.orderBy('createdAt', 'desc')
.get()
.then(function (querySnapshot) {
querySnapshot.forEach(function (doc) {
console.log(doc.data().title)
console.log(doc.data().pid)
posts.push({
pid: doc.data().pid,
title: doc.data().title,
})
})
console.log(posts)
})
.catch(function (error) {
console.log('Error getting documents: ', error)
})
return {
props: {
posts,
}, …Run Code Online (Sandbox Code Playgroud) 我有这个 Rails Reactjs 应用程序,如果我将此行放入表单中
<input type='submit'/>
Run Code Online (Sandbox Code Playgroud)
它将为我创建一个蓝色按钮。我刚刚安装了 Tailwind,如果我用 tailwind 类输入这一行,它不会对按钮设计产生任何影响。
<input type='submit'
className='bg-red-500 text-white font-bold py-2 px-4 rounded-full'/>
Run Code Online (Sandbox Code Playgroud)
有没有一种方法可以覆盖此全局设置,例如将 !important 内联放入 className 中?
任何帮助将不胜感激。