1
在控制檯中使用它?錯誤。將它用作文檔中的一個函數?錯誤。沒有意義。爲什麼?怎麼可能查看狀態?我在使用Laravel 4.2時,如果您想知道其他內容,它包含在主模板中。這是我的頁面的代碼。printState不起作用
@extends('Templates.master')
@section('page-css')
<style>
.option-list {
height: 100vh;
width: 100vh;
top: 0;
bottom: 0;
left: 0;
right: 0;
position: absolute;
}
.option-list.active {
display: block;
}
.option-list.inactive {
display: none;
}
</style>
@stop
@section('amp-component-scripts')
<script async custom-element="amp-selector" src="https://cdn.ampproject.org/v0/amp-selector-0.1.js"></script>
<script async custom-element="amp-bind" src="https://cdn.ampproject.org/v0/amp-bind-0.1.js"></script>
@stop
@section('html-content')
<div class="option-list inactive" [class]="'option-list' + ' ' + myState.optionList.status">
<amp-selector layout="container">
<div option="1">opt 1</div>
<div option="2">opt 2</div>
<div option="3">opt 3</div>
<div option="4">opt 4</div>
</amp-selector>
</div>
<amp-state id="myState">
<script type="application/json">
{
"optionList":{
"status":"inactive",
"options":[
{
"name":"option1",
"icon":"icon1"
},
{
"name":"option2",
"icon":"icon2"
}
]
}
}
</script>
</amp-state>
<button on="tap:AMP.setState({ optionList : { status : 'active' } })">press me plssss</button>
<p [text]="myState.optionList.status">inactive</p>
@stop
閱讀此[github論壇](https://github.com/ampproject/amphtml/issues/8719),我認爲這個功能尚未開始。 – noogui