我的网站将有多个部分,每个部分我打算可以调整大小.为了实现这一点,我制定了一个"可调整大小"的指令,例如:
<div class="workspace" resize="full" ng-style="resizeStyle()">
<div class="leftcol" resize="left" ng-style="resizeStyle()">
Run Code Online (Sandbox Code Playgroud)
使用类似于以下内容的指令:
lwpApp.directive('resize', function ($window) {
return {
scope: {},
link: function (scope, element, attrs) {
scope.getWinDim = function () {
return {
'height': window.height(),
'width': window.width()
};
};
// Get window dimensions when they change and return new element dimensions
// based on attribute
scope.$watch(scope.getWinDim, function (newValue, oldValue) {
scope.resizeStyle = function () {
switch (attrs.resize) {
case 'full':
return {
'height': newValue.height,
'width': (newValue.width - dashboardwidth)
};
case 'left':
return …Run Code Online (Sandbox Code Playgroud) 我是 angular 4 的新手,我一直在尝试创建一个可调整大小的 div(水平),但我无法实现。我想单击抓取来调整 div 的大小。我想水平调整文本区域的大小。也在下面的链接中,鼠标事件应用于文档,但我希望鼠标事件仅应用于抓取类单击而不是文档。请帮帮我
谢谢。
我试过这个 https://stackblitz.com/edit/angular-text-resizable-zvp3ns?file=app%2Fapp.component.ts