我试图用if(!empty)PHP中的函数抛光一些代码,但我不知道如何将它应用于多个变量,当它们不是一个数组时(我以前必须这样做)所以如果我有:
$vFoo = $item[1];
$vSomeValue = $item[2];
$vAnother = $item[3];
Run Code Online (Sandbox Code Playgroud)
然后我想只在有值时才打印结果.这适用于一个变量,所以你有:
if (!empty($vFoo)) {
$result .= "<li>$vFoo</li>";
}
Run Code Online (Sandbox Code Playgroud)
我尝试了一些类似的东西
if(!empty($vFoo,$vSomeValue,$vAnother) {
$result .= "<li>$vFoo</li>"
$result .= "<li>$vSomeValue</li>"
$result .= "<li>$vAnother</li>"
}
Run Code Online (Sandbox Code Playgroud)
但是,当然,它不起作用.
从api输出wine记录的repeat指令.我有一个工厂功能来提供葡萄酒API,然后在我的控制器中访问
app.factory("Wine", function ($http){
var factory = {};
//getWines
factory.getWines = function(){
return $http.get("http://www.greatwines.9000.com")
}
}
Run Code Online (Sandbox Code Playgroud)
控制器:
app.controller("winesCtrl", function($scope, $http, Wine){
Wine.getWines()
.success(function(wines){
$scope.wines = wines;
})
.error(function(){
alert("Error!");
});
});
VIEW:
<h2>Wine list</h2>
<div class="row margin-top-20 wine-container" ng-repeat="wine in wines">
<div class="col-sm-3">
<img src="{{wine.picture}}" class="img-responsive" />
</div>
<div class="col-sm-9">
<div class="margin-top-20">
<span class="bold">Name: </span><span>{{wine.name}}</span>
</div>
<div>
<span class="bold">Year: </span><span>{{wine.year}}</span>
</div>
<div>
<span class="bold">Grapes: </span><span>{{wine.grapes}}</span>
</div>
<div>
<span class="bold">Country: </span><span>{{wine.country}}</span>
</div>
<div>
<span class="bold">Region: </span><span>{{wine.region}}</span>
</div>
<div>
<span class="bold">Price: </span><span>{{wine.price}}</span> …Run Code Online (Sandbox Code Playgroud) 我一直试图通过Openshift连接我的应用程序好几天仍然没有运气.
我不确定到目前为止哪个论坛,因为我在任何地方都没有得到帮助.
1)我将通过终端和运行sudo rhc setup(我使用sudo的原因是因为没有它,它没有进入下一步)
2)然后提示我执行以下操作:
This wizard will help you upload your SSH keys, set your application namespace, and check
that other programs like Git are properly installed.
Using an existing token for myemail@gmail.com to login to openshift.redhat.com
Saving configuration to /Users/myuser/.openshift/express.conf ... done
Checking for git ... found git version 1.9.2
Checking common problems .Enter passphrase for /Users/myuser/.ssh/id_rsa:
Enter passphrase for /Users/myuser/.ssh/id_rsa:
Enter passphrase for /Users/myuser/.ssh/id_rsa:
Run Code Online (Sandbox Code Playgroud)
3)我创建了两次这个SSH密钥,它永远不会接受我的密码给我以下错误:
An SSH connection could not be established to ghost-mydomain.rhcloud.com. …Run Code Online (Sandbox Code Playgroud) 嗨,我正在尝试使用GULP将我的sass文件组织到一个项目的单独块中.但是,当我在单独的文件中导入我的mixins和变量时:
文件:variables.scss
//first import variables that might be used throughout all the other files
@import "common/_variables.scss";
Run Code Online (Sandbox Code Playgroud)
文件:mixins.scss
Mixins
@import "common/_mixins.scss";
Run Code Online (Sandbox Code Playgroud)
然后尝试从其他文件访问这些mixins,例如
文件:buttons.scss @import"common/_buttons.scss";
运行gulp sass时出现以下错误:
throw er; // Unhandled 'error' event
no mixin named 'foo'
or
undefined variable 'foo'
Run Code Online (Sandbox Code Playgroud)
尽管在variable.scss和mixins.scss文件中定义了mixins/variable.因此gulp会中途执行任务,并且不会创建样式表.
SASS中是否有规则意味着变量和mixin必须全部使用它们导入到相同的文件中?如果是这种情况,这是一个问题,因为我有很多文件,我想保持分开,而不必继续导入其中的mixins和变量.
我在为webpack/reactjs应用程序安装软件包时遇到了一个非常奇怪的错误.
我目前正在尝试安装
npm install copy-webpack-plugin --save dev
构建/启动脚本失败,并在终端中显示以下错误:
Unsupported platform for inotify@1.4.1: wanted {"os":"linux","arch":"any"} (current: {"os":"darwin","arch":"x64"})
Run Code Online (Sandbox Code Playgroud)
这意味着绝对注意到我,我在网上找不到任何明确的解释.我不知道为什么需要inotify或者安装的时间/地点.
Package.json脚本:
"scripts": {
"start": "node server.js",
"build": "cross-env BABEL_ENV=production ./node_modules/.bin/webpack --config webpack.config.production.js",
"lint": "eslint --cache --ignore-path .gitignore --format=node_modules/eslint-formatter-pretty . *.js",
"test": "npm run lint"
},
Run Code Online (Sandbox Code Playgroud) 我一直在关于这个问题的论坛帖子中迷失方向。
1)我安装了 MAMP(不是 Pro)
2)我的Apache端口设置为8888
3) 首选项中的 My Document Root 设置为 /Users/usr/Sites
我想设置多个本地子域,即
private/etc/hosts
127.0.0.1 local1.sitename.com
127.0.0.1 local2.sitename.com
127.0.0.1 local3.sitename.com
Run Code Online (Sandbox Code Playgroud)
不,这就是问题出现的地方。在 httpd-vhosts.conf 中,我尝试设置以下内容:
<VirtualHost *:80>
ServerAdmin admin@si1tename.com
DocumentRoot "/Users/usr/Sites/Site1Name“
ServerName local1.sitename.com
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin@site2name.com
DocumentRoot "/Users/usr/Sites/Site2Name“
ServerName local2.sitename.com
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin@site3name.com
DocumentRoot "/Users/usr/Sites/Site3Name“
ServerName local3.sitename.com
</VirtualHost>
etc.
Run Code Online (Sandbox Code Playgroud)
出于某种原因,所有这些子域都指向同一个 localhost:8888 文档根目录。我究竟做错了什么?
谢谢
有可能把这个:
.redstripe p:not(last-child) {
border-bottom:1px solid red;
}
Run Code Online (Sandbox Code Playgroud)
进入mixin,以便我可以将它应用于任何元素并为其分配子标记,如:
@mixin redstripe (this.$children):not(last-child) {
border-bottom:1px solid red;
}
Run Code Online (Sandbox Code Playgroud)
然后申请:
div {
@include redstripe(p);
}
Run Code Online (Sandbox Code Playgroud)
实现这个的正确方法是什么?
我正在尝试创建一个函数,只是让我能够在CSS中输出一个简单的二维地图的键名和键值:
$people: (
"Hellen": (
age: "34",
sex: "female"
),
"Patrick": (
age: "23",
sex: "male"
),
"George": (
age: "10",
sex: "male"
),
"Vicky": (
age: "19",
sex: "female"
)
);
Run Code Online (Sandbox Code Playgroud)
我正在创建一个简单的函数来检索此信息:
@each $person-name, $person-details in $people {
$age: map-get($person-details, 'age');
$sex: map-get($person-details, 'sex');
.#{$person-name} {
height: 100 px;
width: 100 px;
background: #FF3C00;
margin: 0 auto;
&:before {
content:$person-name " " + $age " ";
}
&:after {
content: $sex;
}
}
}
Run Code Online (Sandbox Code Playgroud)
HTML: …
我已经从这个创建了一个新线程以避免混淆,因为有人告诉我Leftnav现在Drawer在Material-UI组件中.
我还有问题,第一个是ES7?这里显示的箭头函数的语法.我已经改为使用扁平链接的以下代码,以便尝试了解发生了什么:
import React, { Component } from 'react'
import { Drawer, AppBar, MenuItem} from 'material-ui'
import baseTheme from 'material-ui/styles/baseThemes/lightBaseTheme'
import getMuiTheme from 'material-ui/styles/getMuiTheme'
import { Route, Router } from 'react-router'
export default class Header extends Component {
constructor(props){
super(props);
this.state = {open:false};
}
getChildContext() {
return {muiTheme: getMuiTheme(baseTheme)};
}
handleToggle() {
this.setState({open: !this.state.open});
console.log("open")
}
handleClose() { this.setState({open: false}); }
render() {
return (
<div>
<Drawer
docked={false}
open={false}>
<MenuItem onTouchTap={this.handleClose}>Menu Item …Run Code Online (Sandbox Code Playgroud) 从其他主题(没有一个对我有帮助)来看,这似乎是一个反复出现的问题,我正在尝试将我的应用程序部署到heroku。它工作得很好heroku local web,我已经部署了应用程序并部署git heroku push到了 master,但是一旦我运行heroku open,就没有加载任何内容,并且出现以下错误:
应用程序错误 应用程序中发生错误,无法提供您的页面。如果您是应用程序所有者,请检查您的日志以了解详细信息。
我检查了我的日志,上面写着:
Error: Cannot find module 'webpack'
Run Code Online (Sandbox Code Playgroud)
我的包 JSON 具有以下依赖项:
"dependencies": {
"babel-runtime": "^6.20.0",
"react": "^15.4.1",
"react-dom": "^15.4.1",
"react-timestamp": "^3.1.0",
"superagent": "^3.3.2"
},
"devDependencies": {
"babel-core": "^6.21.0",
"babel-eslint": "^7.1.1",
"babel-loader": "^6.2.10",
"babel-plugin-react-transform": "^2.0.2",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-0": "^6.16.0",
"cross-env": "^3.1.3",
"css-loader": "^0.26.1",
"eslint": "^3.12.2",
"eslint-config-airbnb": "^13.0.0",
"eslint-formatter-pretty": "^1.1.0",
"eslint-plugin-compat": "^0.1.1",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "2.2.3",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-react": "^6.8.0",
"extract-text-webpack-plugin": "^1.0.1",
"react-transform-hmr": "^1.0.4",
"style-loader": …Run Code Online (Sandbox Code Playgroud) 如何覆盖vuetify中的实际类?
我创建了一个./src/stylus/main.styl文件,在其中我覆盖了一些当前的vuetify设置作为测试:
@import '~vuetify/src/stylus/settings/_variables'
@import '~vuetify/src/stylus/elements/_typography'
$material-dark.background = green
$body-font-family = Arial
$alert-font-size = 18px
.display-2
font-size: $headings.h6.size !important
font-family: $headings.h3.font-family !important
@import '~vuetify/src/stylus/main'
Run Code Online (Sandbox Code Playgroud)
由于某些原因,以上值仅部分起作用。分配给新的价值观$material-dark.background和 $body-font-family下做工精细的东西theme--dark但是,当涉及到.display-2这些值仍呼吁双方原来的设置font-size,并 font-family与覆盖我加入到main.styl的人。我什至尝试过在包含.display-2手写笔的第一个组件中进入范围内的语言,该组件无法正常工作,然后在纯CSS中工作,该组件不会引发错误,但会被app.xxx.css和chunk-vendor中生成的Vuetify原始默认值覆盖。 xxx.css文件。
//component
<style scoped>
h1.display-2{
font-size:20px;
font-family: "Times New Roman";
color:green;
}
</style>
Run Code Online (Sandbox Code Playgroud)
是否有一个原因?
sass ×3
mixins ×2
webpack ×2
apache ×1
appbar ×1
drawer ×1
duplicates ×1
gulp ×1
heroku ×1
is-empty ×1
local ×1
mamp ×1
material-ui ×1
node.js ×1
openshift ×1
package.json ×1
php ×1
procfile ×1
scss-lint ×1
ssh-keys ×1
stylus ×1
virtualhost ×1
vue-cli-3 ×1
vue.js ×1
vuetify.js ×1