我正在尝试使用 brew 在我的 Mac 上安装 MariaDB。但是,由于它与 MySQL 冲突,我很难安装它。我想知道是否有人可以建议如何设置它,所以我有 MariaDB 和 MySQL,因为我在我的机器上需要这两个,因为我在多个项目中需要使用一个或另一个。
3x-iMac:~ admin$ mysql.server start
Starting MariaDB
SUCCESS!
3x-iMac:~ admin$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 8.0.11 MySQL Community Server - GPL
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
3x-iMac:~ admin$ mysql -u root …Run Code Online (Sandbox Code Playgroud) 我已经安装了tippy.js 来处理我的工具提示,但是我正在努力让工具提示显示数据属性中设置的内容。我的默认工具提示工作正常,但是当我通过类初始化时,为了能够向工具提示添加不同的样式,它不会从工具提示中获取内容。
tippy.setDefaults({
animation: 'scale',
animateFill: false,
maxWidth: 240,
duration: 0,
arrow: false,
})
tippy('.js-tippy-reviews', {
theme: 'reviews',
animation: 'scale',
animateFill: false,
maxWidth: 240,
duration: 0,
arrow: false,
})
Run Code Online (Sandbox Code Playgroud)
如果我将内容方法添加到tippy,它将显示,但是由于工具提示的内容是动态的,我需要在数据属性上设置它。我不确定如何将数据属性从元素传递到tippy。
content: this.dataset.tippy
Run Code Online (Sandbox Code Playgroud)
有什么想法我做错了吗?
HTML:
<div class="js-tippy-reviews reviews-notification" data-tippy="2 Pending Reviews"></div>
Run Code Online (Sandbox Code Playgroud) 我正在努力理解如何将 JS 变量传递到 className 中,例如:
<img className="pos-1 speed-${Math.floor(Math.random() * 10) + 1}" src={Onion1} />
Run Code Online (Sandbox Code Playgroud)
其中{Math.floor(Math.random() * 10) + 1}将设置一个范围编号,以便我可以为 speed-1、speed-2 等随机添加类。
console.log(`pos-1 speed-${Math.floor(Math.random() * 10) + 1}.`);
<img className=`pos-1 speed-${Math.floor(Math.random() * 10) + 1}.` src={Onion1} />
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?
还尝试过:
const classes = () => {
return `pos-${Math.floor(Math.random() * 10) + 1} speed-${Math.floor(Math.random() * 10) + 1}.`;
}
<img className={classes} src={Onion1} />
Run Code Online (Sandbox Code Playgroud) <script type="text/javascript">
function WorldwideSellingModelCookie(){
days=7;
myDate = new Date();
myDate.setTime(myDate.getTime()+(days*24*60*60*1000));
document.cookie = 'WorldwideSellingModelCookie=Accepted; expires=' + myDate.toGMTString();
}
function CheckCookies(){
var worldwideSellingCookie = getCookie("WorldwideSellingModelCookie");
if (worldwideSellingCookie == "Accepted")
{
jQuery(".alert-worldwide").hide();
}
}
CheckCookies();
</script>
Run Code Online (Sandbox Code Playgroud)
你好
正在创建cookie,我只是不确定如何在我的CheckCookies函数中使用if语句,以便在页面上隐藏div?
我收到以下控制台错误:
未捕获的ReferenceError:未定义getCookie
谁能告诉我我在做什么错?
谢谢
更新:
<script type="text/javascript">
function WorldwideSellingModelCookie(){
days=7;
myDate = new Date();
myDate.setTime(myDate.getTime()+(days*24*60*60*1000));
document.cookie = 'WorldwideSellingModelCookie=Accepted; expires=' + myDate.toGMTString();
}
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c …Run Code Online (Sandbox Code Playgroud) 我在Javascript中有一个简单的点击功能,我正在努力工作.我遇到的问题是click函数只适用于类的第一个元素,当你点击类的任何元素时我希望它触发.
const element = document.querySelector('.js-element')
if ( element ) element.addEventListener('click', function () {
alert('click');
})
Run Code Online (Sandbox Code Playgroud)
任何人都可以告诉我哪里出错了?
谢谢