我有这些代码将数据从控制器传递到视图:
$fb = new Facebook\Facebook([
'app_id' => 'XXX',
'app_secret' => 'XXX',
'default_graph_version' => 'v2.7',]);
$pageId = //find the page id
$accessToken = //and the access token
$response = $fb->get('/'.$pageId.'/feed', (string) $accessToken);
$response = $response->getDecodedBody();
$pagePosts = $response['data'];
foreach ($pagePosts as $post) {
//query for the likes and count them
$likesResponse = $fb->get('/'.$post['id'].'/likes', (string) $accessToken);
$likesObject = $likesResponse->getDecodedBody();
echo 'likes count: '.count($likesObject['data']).'<br>';
//comments and shares similar to likes
}
但是,传递给var casper = require('casper').create({
verbose: true,
logLevel: "debug",
waitTimeout: 10000,
viewportSize: {
width: 1024,
height: 760
}
});
/*
* PARAMETERS
*/
var listItems = [];
var location = casper.cli.args[0];
casper.start('http://www.vibbo.com/pisos-y-casas-barcelona-capital/', function() {
this.echo(this.getHTML('title'));
this.captureSelector('vibbo-1.png', 'html');
casper.click('#sb_location');
this.captureSelector('vibbo-2.png', 'html');
});
casper.waitUntilVisible('#ui-id-1', function() {
casper.sendKeys('#sb_location', 'Valencia');
this.wait(1000, function() {
this.captureSelector('vibbo-3.png', 'html');
});
this.echo(listItems);
});
casper.run();
中 <div class="subject-name subject-eng">
{{SubjectData['eng']['subject']}} <!-- Works -->
<br/>
{{SubjectData['eng']['value']}} <!-- Works -->
<br/>
{{SubjectData['eng']['color']}} <!-- Works -->
</div>
<circular-progress
value = "{{SubjectData['eng']['value']}}" <!-- Did not Works -->
max="100"
orientation="1"
radius="36"
stroke="5"
base-color="#fff"
progress-color="yellow"
iterations="100"
animation="easeInOutCubic"
></circular-progress>
的数据根本不起作用。将数据传递到value
的正确方法是什么?
答案 0 :(得分:1)
感谢leroydev,您可以节省我的一天。我通过修改代码找到了解决方案
<circular-progress
value = "SubjectData.eng.value" <!-- Works perfectly! -->
max="100"
orientation="1"
radius="36"
stroke="5"
base-color="#fff"
progress-color="yellow"
iterations="100"
animation="easeInOutCubic"
></circular-progress>
我通过阅读第56行的说明找到了解决方案: