从原生导入
<script src
="../js/vue.js"></script
>
ruoyi
-ant\src\utils\request
.js
import Vue
from 'vue'
import axios
from 'axios'
过渡导入
ruoyi
-ant\src\api\system
.js
import { axios
} from '@/utils/request'
路径
./ 表示当前目录下 …/ 表示父级目录下 @/ 是webpack设置的路径别名,代表什么路径,要看webpack的build文件夹下webpack.base.conf.js里面对于@是如何配置
import { getRoleList
, delRole
, changRoleStatus
} from '@/api/system' js文件
import RoleModal
from './modules/RoleModal.vue' vue文件
tableList
1.template一个<s:table>
<s
-table
size
="default"
ref
="table"
rowKey
="roleId"
:rowSelection
="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
:columns
="columns"
:data
="loadData"
>
2.JS一个 export default {}
export default {
name
: 'TableList',
components
:{STable
,RoleModal
,RoleScopeModal
},
data () {
return {
columns
:[],
loadData
: parameter
=> {
return getRoleList(Object
.assign(parameter
, this.queryParam
))
},
addEnable
: checkPermission('system:role:add'),
}
}
methods
: {
onSelectChange (selectedRowKeys
) {},
handleAdd (parentId
) {}
},
}
新建/删除按钮
<a
-button v
-if="addEnable" type
="primary" icon
="plus" @click
="$refs.modal.add()">新建
</a
-button
>
<a
-dropdown v
-if="removeEnable&&selectedRowKeys.length > 0">
button type
="danger" icon
="delete" @click
="delByIds(selectedRowKeys)">删除
</a
-button
>
</a
-dropdown
>
$refs
$refs
.modal
.add()
this.$refs
.modal
.edit(record
)
提示框
this.$message
.success(`删除成功`)
this.$message
.error(res
.msg
)
转载请注明原文地址: https://mac.8miu.com/read-488465.html