我正在玩谷歌饼图API.
一切都运行正常,除了笔画选项:和strokeWidth :. 无论我把它们设置为什么,都没有变化.
我有一个深色的背景颜色,切片之间的线条是白色的.我正在尝试将它们更改为与背景相同的颜色.我也无法改变这些线条的宽度.
这是我的代码:
<script src="https://www.google.com/jsapi"></script>
<script>
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Task');
data.addColumn('number', 'Hours per Day');
data.addRows(5);
data.setValue(0, 0, 'Work');
data.setValue(0, 1, 11);
data.setValue(1, 0, 'Eat');
data.setValue(1, 1, 2);
data.setValue(2, 0, 'Commute');
data.setValue(2, 1, 2);
data.setValue(3, 0, 'Watch TV');
data.setValue(3, 1, 2);
data.setValue(4, 0, 'Sleep');
data.setValue(4, 1, 7);
// Create and draw the visualization.
new google.visualization.PieChart(document.getElementById('poll-chart')).
draw(data, {
title:"",
fontSize: "12",
legend: "none",
width: 200,
height: 200,
chartArea: { …Run Code Online (Sandbox Code Playgroud) 我正在使用WP_Query(非常标准).这一切都很棒.
但是,我做了一个特别的修改,其中,如果用户在URL中输入特定的帖子名称,搜索将只返回匹配该post_name值的帖子.
请参阅下面的代码,其中包含有关特定行无效的注释.
<?php
$getPeople = array(
'post_type' => 'person',
'posts_per_page' => -1,
// I want this below to only return me the post with this specific value.
// This doesn't error, but doesn't work either.
// I know it seems counter-productive to a 'search' but this particular case requires it.
// This has a hard-coded value at the moment.
'post_name' => 'rebecca-atkinson',
'orderby' => 'meta_value',
'meta_key' => 'last-name',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'gender',
'value' …Run Code Online (Sandbox Code Playgroud) 我是Grunt的新手.我以为我会尝试一下,所以我创建了这个grunt文件.
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
css: {
src: [
'./css/*'
],
dest: './css/all.css'
},
js: {
src: [
'./js/*'
],
dest: './js/all.js'
}
},
uglify: {
js: {
files: {
'./js/build/all.min.js': ['./js/all.js']
}
}
},
sass: {
build: {
files: [{
expand: true,
cwd: './css/sass',
src: ['*.scss'],
dest: './css',
ext: '.css'
}]
}
},
cssmin: {
css: {
src: './css/all.css',
dest: './css/build/all.min.css'
}
},
watch: {
files: ['./css/sass/*', './js/*'],
tasks: ['sass:build','concat:css', 'cssmin:css', 'concat:js', 'uglify:js']
} …Run Code Online (Sandbox Code Playgroud) Vue Cli默认file-loader为SVG资产,但我想使用svg-sprite-loader(以及其他一些).
我更新了vue.config.js文件来执行此操作,它似乎仍然使用file-loader.几乎就好像它根本没有拿起我的配置.
vue.config.js
module.exports = {
configureWebpack: {
module: {
rules: [
{
test: /\.(svg)(\?.*)?$/,
use: [
{
loader: 'svg-sprite-loader',
options: {
name: '[name]-[hash:7]',
prefixize: true
}
},
'svg-fill-loader',
'svgo-loader'
]
}
]
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的设置有什么问题吗?
当它应该是具有属性的对象时,我仍然将SVG文件作为URL字符串/路径导入到我的组件中.
非常感谢.
考虑以下代码gatsby-config.js:
module.exports = {
plugins: [
{
resolve: `gatsby-source-fetch`,
options: {
name: `brands`,
type: `brands`,
url: `${dynamicURL}`, // This is the part I need to be dynamic at run/build time.
method: `get`,
axiosConfig: {
headers: { Accept: "text/csv" },
},
saveTo: `${__dirname}/src/data/brands-summary.csv`,
createNodes: false,
},
},
],
}
Run Code Online (Sandbox Code Playgroud)
正如您在上面看到的,源插件的 URL 需要是动态的。原因是文件 URL每次在 CMS 中更新时都会发生变化。我需要在 CMS 中查询该字段并获取其 CDN URL,然后再传递给插件。
我尝试将以下内容添加到顶部gatsby-config.js,但出现错误。
const axios = require("axios")
let dynamicURL = ""
const getBrands = async () => { …Run Code Online (Sandbox Code Playgroud) 这是我第一次使用JSON的经历,所以我可能会做一些非常愚蠢的事情.
我构建了一个应用程序来刮取页面并返回一个JSON对象.
我的JSON返回看起来像这样(以Facebook为例):
{"urlTitle":"Welcome to Facebook \u2014 Log in, sign up or learn more","urlDescription":" Facebook is a social utility that connects people with friends and others who work, study and live around them. People use Facebook to keep up with friends, upload an unlimited number of photos, post links and videos, and learn more about the people they meet."}
Run Code Online (Sandbox Code Playgroud)
但是,在FireBug中我得到了上述错误(另见截图).
我的jQuery代码通过AJAX获取JSON,现在看起来很简单:
$("#submitButton").on("click", function(){
$.ajax({
url: '/miscellaneous/scrape/scrape.cfm',
dataType: 'json',
data: {
strURL: $.param( $("#submitURL").attr("value") )
},
type: 'POST',
success: function(data) { …Run Code Online (Sandbox Code Playgroud) 我试图将一个过滤器注入我的控制器并使用它:
angular
.module('graduateCalculator', [])
.filter('slug', function() {
return function(input) {
if(input) {
return input.toLowerCase().replace(/[^a-z-]/g, '-');
}
};
}).controller('GraduateCalculatorController', ['$filter', app.graduateCalculator($filter)]);
Run Code Online (Sandbox Code Playgroud)
但是,我得到了上述错误.我显然做了一些非常错误的事情 - 对我来说不够明显.
Uncaught ReferenceError: $filter is not defined
Run Code Online (Sandbox Code Playgroud)
它可能与我的功能有关.它是这样写的:
var app = {
graduateCalculator: function($filter) {
window.console.log( $filter('slug')('A random looking string...') );
}
};
Run Code Online (Sandbox Code Playgroud)
帮助赞赏!
希望这是一个相当简单的问题/答案,但我在文档中找不到太多信息.
有没有办法<router-link>根据是否传入道具来启用或禁用生成的锚?
<router-link class="Card__link" :to="{ name: 'Property', params: { id: id }}">
<h1 class="Card__title">{{ title }}</h1>
<p class="Card__description">{{ description }}</p>
</router-link>
Run Code Online (Sandbox Code Playgroud)
如果没有id传递给该组件,我想禁用正在生成的任何链接.
有没有办法在不将内容加倍的情况下做到这一点v-if?
谢谢!
我读过有关使用node_modulesNuxt 进行转译的问题,但据说新的 Nuxt 2 已经通过文件transpile中的选项解决了这个问题nuxt.config.js。
https://nuxtjs.org/api/configuration-build/#transpile
这是我所拥有的:
export default {
router: {
base: '/',
},
build: {
transpile: [
'choices.js',
'lazysizes',
'swiper',
'vee-validate'
],
extractCSS: true
},
srcDir: 'src/',
performance: {
gzip: true
},
render: {
compressor: {
threshold: 100
}
},
dev: false
}
Run Code Online (Sandbox Code Playgroud)
为了方便阅读,我删除了一些不相关的内容。
当我运行npm run build( nuxt build) 时,编译后的 JS 文件包含对 es6 和 es7 代码的引用,例如const和let等var。
我已将此问题隔离为来自Swiper。它似乎在内部依赖于一个名为 Dom7 的东西,而这个东西似乎导致了这个问题。
如果可能的话,我想将这些node_modules …
我的 Nuxt.js 配置中有一个 Google Tag Manager 模块,如下所示:
modules: [
[
'@nuxtjs/google-tag-manager',
{
id: 'GTM-XXXXXXX'
}
]
]
Run Code Online (Sandbox Code Playgroud)
这工作正常,但我想知道如何根据站点设置的 cookie 值有条件地加载此模块?
我们有一种机制,用户可以通过该机制选择接受或拒绝某些 cookie,其中一部分是阻止跟踪脚本。
有没有推荐的方法来使用通过配置加载的模块或脚本?理想情况下,如果将来 cookie 中的值也发生变化,则可以加载这些。
非常感谢任何帮助或指示。