Git Product home page Git Product logo

regular-state's People

Contributors

leeluolee avatar rainfore avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

regular-state's Issues

如何在跳转过程中中止中跳转并跳到另一个页面?

是这样的情况:

const router = Restate({routes: {
   'app': {
           url: '',
           view: Application
    },
    'app.introduce':{
           url: '',
            view: Introduce
    },
   'app.view': {
           view: View
    }
})

默认是会跳转到 app.introduce, 但如果因为某些条件的需要比如恢复上次的状态, 这个时候就不需要先转到app.introduce, 有没有方法可以直接启动就跳转到app.view.

如果在初始化后直接调用: router.go("app.view") 会出现app里的共有模板出现双份复制的情况

动态菜单怎么在用户登录之后刷新菜单?

//登录
$http.post('/api/v1.0/sessions', {username: username, password: password, rememberMe: rememberMe}, (rep)->
          data.ferror = false
          data.loading = false
          #返回的user数据
          $state.user = rep
          try
            localStorage.setItem('username', username)
          //把菜单权限存到localStorage
            localStorage.setItem("permissions", stateman.user.permissions)
          catch e

          data.password = null
          component.$update()

          #跳转
          $state.go("app.order");
)
//app模块的菜单数据 菜单组件 <app-menu ref="appMenu" menus={menus} state={@(this.$state)}></app-menu>
config: (data)->
      data.menus = [
        {url: '/', name: '首页', icon: 'home', state: 'app.index'}
      ]

      try
        permissions = localStorage.getItem("permissions")
      catch e

      if permissions
        permissions=permissions.split(",")
        for permission in permissions
          switch permission
            when 'P_ORDER' then data.menus.push({url: '/order', name: '订单', icon: 'table', state: 'app.order'})
            when 'P_SALE' then data.menus.push({url: '/sale', name: '销售', icon: 'strikethrough', state: 'app.sale'})
            when 'P_FINANCE' then data.menus.push({url: '/finance', name: '财务', icon: 'yen', state: 'app.finance'})
            when 'P_SETTING' then data.menus.push({url: '/setting', name: '设置', icon: 'configure', state: 'app.setting'})

路由卸载功能支持

因为微前端方案需要做成应用可插拔,所以产生了需要卸载路由的需求。

尝试使用stop方法卸载:

stateman 提供了 stop 方法,但是该方法只卸载了内部histery, 组件依然在内存中,所以组件的destroy方法不会触发, 导致应用无法卸载干净,对于全局对象的事件没能及时销毁。

所以希望能够提供一种能够销毁方案来销毁整个应用, 例如在 https://github.com/regularjs/regular-state/blob/master/src/client.js#L157 这里新增一个 destroy 的生命周期,并重载 stateman 的 stop 方法调用 destroy 实现。

文档错误 r-link

image

<a href="app.a.b.c">配置</a>
<a r-link="app.a.b.c">配置</a>
<a r-link href="app.a.b.c">配置</a>

按照文档内容依然不知道具体r-link怎么用的。上面三种写法均未生效.

r-view应该支持内嵌组件

比如组件

const Component = Regular.exnted({
  name: 'Component',
  template: `
      <div r-view > Nest Component with r-view </div>
 `
})

const Module = Regular.extend({
  template: `
    <Component />
 `
})

这个Module 作为路由模块,这个r-view就不生效了

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.