Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app_conf能不能访问submodel的上一级路径? #66

Open
Tracker647 opened this issue Dec 30, 2024 · 2 comments
Open

app_conf能不能访问submodel的上一级路径? #66

Tracker647 opened this issue Dec 30, 2024 · 2 comments

Comments

@Tracker647
Copy link

Tracker647 commented Dec 30, 2024

比如有这样一个结构:

{
    "range" : {
        "Manual" : true,
        "Auto" : false
    },
    "Accuvision" : {
        "pic" : {
            "one_eight" : false,
            "two_eight" : false,
            "three_eight" : true
        }
    },
    "Smartvision" : {
        "pic" : {
            "one_eight" : true,
            "two_eight" : false,
            "three_eight" : false
        }
    }
}

我有两个菜单页面Accuvision.xml和Smartvision.xml,两个菜单各自数据绑定Accuvision和Smarvision,range的设置是共享的。
UI设计原因,Accuvision.xml和Smartvision.xml有大量界面元素用了component复用,我不想改了Accuvision.xml布局去直接索引,而是想在指定Accuvision为submodel的基础上去取到上一级的range,比如:

<window v-model="app_conf" name="home_page" on:window_open="func_home_page_init()" v-on:window_close="{save}">
  <view name="view" v-model="sub_view_model:Accuvision" x="22" y="32" w="542" h="301">
    <view name="range" x="0" y="0" w="322" h="93">
      <radio_button name="radio_button" v-data:value="{..range.Manual}" v-on:click="{save}" x="35" y="42" w="100" h="20" text="Manual"/>
      <radio_button name="radio_button1" v-data:value="{..range.Auto}" v-on:click="{save}" x="172" y="42" w="100" h="20" text="Auto"/>
    </view>
    <view name="pic" x="0" y="93" w="322" h="93">
      <radio_button name="radio_button" v-data:value="{pic.one_eight}" v-on:click="{save}" x="10" y="22" w="100" h="20" text="1/8"/>
      <radio_button name="radio_button1" v-data:value="{pic.two_eight}" v-on:click="{save}" x="110" y="22" w="100" h="20" text="2/8"/>
      <radio_button name="radio_button1" v-data:value="{pic.three_eight}" v-on:click="{save}" x="212" y="22" w="100" h="20" text="3/8"/>
    </view>
  </view>
</window>

有没有这样访问上一级的语法?

@Tracker647
Copy link
Author

目前看来app_conf是没法在submodel找不到属性时自动访问上一级的。

@xianjimli
Copy link
Member

没有这种用法。还是用单一模型吧。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants