|
感谢提出优化开发文档的建议。
ACT组件库是使用的 render 函数来开发的,类似 React 的 JSX 。目前文档是有这种方式的介绍的。
https://docs.apicloud.com/apiclo ... ex=5&subIndex=2
另外AVM 在开发上来说,是可以React风格和Vue混编的。
如下是一个简单的例子,看看能否满足你的slot的功能:
// Main 父级页面
- <template>
- <view class="page">
- <Test content={ <text>1</text> } />
- <demo content={ <text>2</text> } />
- </view>
- </template>
- <script>
- import Test from '../../components/Test.js';
- import '../../components/Demo.stml';
- export default {
- name: 'main',
- }
- </script>
- <style>
- .page {
- height: 100%;
- }
- </style>
复制代码
// React 风格的组件:
- export default class Test extends Component {
- render(props) {
- return <view> {props.content} </view>
- }
- }
- avm.define('Test', Test);
复制代码
// STML /VUE风格的组件:
- <template>
- <view class="page">
- <text>demo.stml</text>
- <view> {{this.props.content}} </view>
- </view>
- </template>
- <script>
- export default {
- name: 'demo'
- }
- </script>
复制代码
|
|